MODx Community Forums
The MODx Blog
Donations
Feedburner Feeds
Documentation
Bugs & Support
The Wiki
download MODx
plugins, modules, snippets
online demo
May 17, 2008, 10:33 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
modxcms.com
web
MODxCMS.com
Forums
Help
Login
Register
News
:Donate to MODx:
Donations
MODx Community Forums
»
Support
»
Module, Plugin & Snippet Usage
(Moderators:
zi
,
PaulGregory
)
»
Is it possible to change values when a document is saved in the manager?
Pages: [
1
]
Go Down
« Previous topic
Next topic »
Print
Author
Topic: Is it possible to change values when a document is saved in the manager? (Read 1434 times)
0 Members and 1 Guest are viewing this topic.
Mitch
Full Member
Posts: 217
Is it possible to change values when a document is saved in the manager?
«
on:
Dec 26, 2005, 06:59 AM »
I am trying to make sure that my users fill in a longtitle when they create a document. My idea was to use the normal title for longtitle if they forgot to fill it in.
I tried to make a plugin that acts on the OnBeforeDocSave event. So I could check if longitle was filled in. If not make the longtitle equal to the normal title. But I only get the id of the document beeing edited from the event. I don't see a way to get access to the data that is going to be saved.
Am I overlooking something or should I use another approach?
Logged
madmage
Full Member
Posts: 146
Re: Is it possible to change values when a document is saved in the manager?
«
Reply #1 on:
Dec 26, 2005, 07:12 AM »
We developer REALLY NEED a plug-in documentation... I'm sorry to go on asking work... but this will BOOST the development of MODx, since not only the core developer will be aware of the hidden stuff of MODx
Logged
rthrash
Foundation
Posts: 8,791
Re: Is it possible to change values when a document is saved in the manager?
«
Reply #2 on:
Dec 26, 2005, 09:20 AM »
madmage, we really agree!
This is an area that we want to do a much better job on and really help folks understand. And I promise that we're working on it!
Logged
MODx
is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you
help us help you
,
read the wiki
, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @
Collabpad
work
productively.
work
intelligently.
work
together.
MODx
Current
|
Dev
|
SVN Root
|
JIRA (Bugs)
|
Confluence (097 Wiki)
|
Fisheye SVN Browser
xwisdom
Foundation
Posts: 1,732
Re: Is it possible to change values when a document is saved in the manager?
«
Reply #3 on:
Dec 29, 2005, 03:34 AM »
Quote from: Mitch on Dec 26, 2005, 06:59 AM
I tried to make a plugin that acts on the OnBeforeDocSave event. So I could check if longitle was filled in. If not make the longtitle equal to the normal title. But I only get the id of the document beeing edited from the event. I don't see a way to get access to the data that is going to be saved.
The data that's going to be saved can be found inside the $_POST variable. For example $_POST['longtitle']
Logged
xWisdom
www.xwisdomhtml.com
The fear of the Lord is the beginning of wisdom:
MODx Co-Founder
- Create and do more with less.
Djamoer
Testers
Posts: 1,492
No one can limit a man other than the man himself.
Re: Is it possible to change values when a document is saved in the manager?
«
Reply #4 on:
Dec 29, 2005, 08:37 AM »
Yep, and you can change the content of that $_POST vars, so that you can fill out any values that you desired.
Btw, how about us, the developer to start building documentation, for example madmage, it seems that you know quite a lot of it, so you can start making a really simple documentation for the doc team to polish it and expand it further.
Don't ask me to do it though, I'm kinda lazy in writing something, especially documentation.... LOL...
Logged
Wendy Novianto (
DJAMOER Solution and Design
)
Search
|
Download Latest Release
|
General Support
About MODx
|
Documentation
|
Bugs/Wishlist
|
FORUM RULES
Mitch
Full Member
Posts: 217
Re: Is it possible to change values when a document is saved in the manager?
«
Reply #5 on:
Jan 03, 2006, 02:10 PM »
I ended up with using the data from the $_POST on the OnDocFormSave event and then update the database if needed. I made a plugin called AutomaticLongtitle the code is pasted below. Remember to register the OnDocFormSave for this plugin if you decide to use it.
Code:
$e = &$modx->Event;
// Only on this event
if ($e->name == 'OnDocFormSave')
{
// Check if the longtitle is empty
if ($_POST['longtitle'] == '' && $_POST['pagetitle'] != '')
{
$fields = array('longtitle' => $_POST['pagetitle']);
$table = $modx->getFullTableName('site_content');
// Update the database
$rows_affected = $modx->db->update(
$fields,
$table,
"id = {$e->params['id']}"
);
// Generate an error if the DB was not updated
if(!$rows_affected)
{
$modx->event->alert("AutomaticLongtitle: An error occured when saving the longtitle.");
}
}
}
Logged
Pages: [
1
]
Go Up
Print
« Previous topic
Next topic »
Jump to:
Please select a destination:
-----------------------------
Announcements
-----------------------------
=> Important News
=> Security Notices
-----------------------------
Commercial Support
-----------------------------
=> [CS] About Commercial Support
-----------------------------
Development & Coding
-----------------------------
=> Commercial Inquiries & Bounties
=> Core Code
===> MODx Next
===> xPDO
=> Module, Plugin & Snippet Creation and Modification
=> In Development
=> Templates
=> Internationalization
===> Bulgarian
===> Chinese
===> Czech
===> Dutch
===> French
===> German
===> Irish
===> Italian
===> Japanese
===> Polish
===> Portuguese
===> Russian
===> Slovak
===> Spanish
===> Swedish
===> Persian - فارسي
-----------------------------
Support
-----------------------------
=> Release Support
===> 0.9.6.1
===> 0.9.6
===> 0.9.5 and earlier
=> General Support
===> MODx 101
===> E-Commerce, E-Marketing, Analytics & SEO
===> Hosting Experiences
===> IIS / Windows Hosting Issues
=> Repository Items Support
===> Ditto
===> eForm
===> Jot
===> MaxiGallery
===> Wayfinder
===> Rich Text Editors & File Browser
===> WebLoginPE
=> Module, Plugin & Snippet Usage
=> Documentation, Tips & Tricks
===> Documentation Suggestions & Corrections
-----------------------------
General Discussions
-----------------------------
=> General MODx Discussions
=> Web Design and Development
=> Wishlist
=> You and Your Sites
=> modxcms.com Discussions and Suggestions
=> Off-topic
-----------------------------
Bulgarian Community
-----------------------------
=> Поддръжка
===> Често задавани въпроси
===> Инсталация
===> Модули, Плъгини, Снипети и код
===> Дизайн и Шаблони
=> Документация, Ръководства и Превод
===> Документация
===> Ръководства
===> Превод
=> Общество
===> Съобщения
===> Представете се
===> Представете сайта си
===> Дискусии извън MODx
-----------------------------
Dutch Community
-----------------------------
=> Ondersteuning
===> Veel gestelde vragen
===> Modules, Plugins, Snippets & Code
===> Design & Templates
=> Documentatie, Tutorials en Vertalingen
===> Documentatie
===> Tutorials
===> Vertalingen
=> Community
===> Aankondigingen
===> Stel jezelf voor
===> Site Showcase
===> De stamkroeg
-----------------------------
Finnish Community
-----------------------------
=> Tuki
===> UKK
===> Asennus
===> Moduulit, liitännäiset, koodinpätkät
===> Ulkoasu/Sivustopohjat
=> Dokumentaatio, oppaat ja käännökset
===> Dokumentaatio
===> Käännökset
===> Oppaat
=> Yhteisö
===> Tiedotteet
===> Esittele itsesi
===> MODx sivustosi
===> Kahvihuone
-----------------------------
Filipino Community
-----------------------------
=> Suporta
===> Kadalasang tanong
===> Instalasyon
===> Moduler, Maidadagdag, Karagdagang mga Code
===> Desenyo at Templates
=> Dokumentasyon, Mga Turo, Mga Salin
===> Dokumentasyon
===> Mga Turo
===> Mga Salin
=> Kumunidad
===> Anunsyo
===> Ipakilala ang sarili
===> Ang Galing ng pinoy
===> Tsismisan atbp
-----------------------------
French Community
-----------------------------
=> Support
===> FAQ
===> Installation
===> Module, plugin, snippets
===> Design/Templates
=> Documentation, Tutoriels et Traductions
===> Documentation
===> Traduction
===> Tutoriels
=> Communauté
===> Annonces
===> Présentez vous
===> Vos sites
===> Le Bistrot Français
-----------------------------
German Community
-----------------------------
=> Support (de)
===> FAQ (de)
===> Installation (de)
===> Module, Plugins, Snippets & Code (de)
===> Design & Templates (de)
=> Dokumentation, Tutorials und Übersetzung
===> Dokumentation
===> Tutorials (de)
===> Übersetzung
=> Community (de)
===> Ankündigungen
===> Stellt Euch vor
===> Beispielseiten
===> Off Topic / Verschiedenes
-----------------------------
Irish Community
-----------------------------
=> Tacaíocht
===> CC Ceisteanna Coitianta
===> Breiseáin (cláir bhreise), Snippets & Comhaid
===> Suiteáil
===> Dearadh & Teimpléid
=> Doiciméid, Teagascóireacht agus Aistriúchán
===> Doiciméadú
===> Teagascóireacht
===> Aistriúchán
=> Pobal
===> Fógraí
===> Cuir Tú Féin in Aithne
===> Gailearaí an Láithreáin
===> Caifé / An Tábhairne / Ábhar Cainte Eile / Ilghnéitheach
-----------------------------
Italian Community
-----------------------------
=> Supporto
===> FAQ
===> Installazione
===> Moduli, Plugin, Snippet e altro codice
===> Web Design e Template
=> Documentazione, Tutorial e Traduzione
===> Documentazione
===> Tutorial
===> Traduzione
=> Comunità
===> Annunci
===> Presentazioni
===> Siti in vetrina
===> Chiacchiere in libertà
-----------------------------
Japanese Community
-----------------------------
=> サポート
===> 良くある質問
===> インストール
===> モジュール・プラグイン・スニペット・本体
===> デザインやテンプレート
=> マニュアル・テュートリアル・翻訳
===> マニュアル
===> 事例集、テュートリアル
===> 日本語化
=> コミュニティ
===> お知らせ
===> MODxサイト展示場
===> 自己紹介
===> 雑談
===> 国産リソース
-----------------------------
Persian Community
-----------------------------
=> پشتيباني
===> راهنما
===> نصب
===> ماژول , پلاگین ها , کد ها و جزییات
===> طراحی و قالب ها
=> مستند سازی , آموزش ها و ترجمه ها
===> مستند سازی
===> آموزش ها
===> ترجمه ها
=> انجمن ها
===> اخبار
===> معرفی کردن خود
===> نمایش دادن سایت ها
===> بحث های عمومی و سایر موضوعات
-----------------------------
Polish Community
-----------------------------
=> Wsparcie
===> FAQ
===> Instalacja
===> Moduły, pluginy, snipety i kod
===> Wygląd i szablony
=> Dokumentacja, tutoriale i tłumaczenie
===> Dokumentacja
===> Tutoriale
===> Tłumaczenie
=> Społeczność
===> Ogłoszenia
===> Przedstaw się
===> Twój serwis WWW
===> Hyde Park
-----------------------------
Portuguese Community
-----------------------------
=> Suporte
===> FAQ - Dúvidas Frequentes
===> Instalação
===> Módulos, Plugins, Snippets e Código
===> Design e Templates
=> Documentação, Guias e Traduções
===> Documentação
===> Guias
===> Traduções
=> Comunidade
===> Anúncios
===> Apresente-se!
===> Bar da esquina (fora de tópico)
===> Portfólio de Sites
-----------------------------
Russian Community
-----------------------------
=> Поддержка
===> ЧАВО (FAQ)
===> Установка
===> Модули, плагины, сниппеты и код
===> Дизайны и шаблоны
=> Документация, Уроки, Перевод
===> Документация
===> Уроки
===> Перевод
=> Сообщество
===> Объявления
===> Представьтесь публике
===> Галерея сайтов
===> Диван
-----------------------------
Scandinavian Community
-----------------------------
=> Support
===> Frågor och svar
===> Installation
===> Moduler, plugins, snippets och kod
===> Design & sidmallar
=> Dokumentation, guider och översättningar
===> Dokumentation
===> Guider
===> Översättningar
=> Webbgemenskap
===> Meddelanden
===> Presentera dig själv
===> Visa upp dina webbsidor
===> Ordet fritt
-----------------------------
Spanish Community
-----------------------------
=> Soporte
===> FAQ
===> Instalación
===> Modulos, Plugins, Snippets & Código
===> Diseño y plantillas
=> Documentación, Tutoriales y Traducciones
===> Documentatción
===> Tutoriales
===> Traducciones
=> Comunidad
===> Anuncios
===> Presentaciones personales
===> Muestra de sitios
===> El Café
-----------------------------
TÜRKÇE (Turkish)
-----------------------------
=> Destek
===> SSS
===> Kurulum
===> Modüller, Pluginler, Snippetlar & Kodlar
===> Dizayn & Temalar
=> Belgeleme, Eğitmenler ve Çeviri
===> Belgeleme
===> Eğitmenler
===> Çeviri
=> Topluluk
===> Duyurular
===> Kendinizi Tanıtın
===> Site Vitrini
===> Konu Dışı