Questions about Events Adding notification to Content Edit

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
dmgd
Forum Members
Forum Members
Posts: 115
Joined: Tue Jun 06, 2006 1:10 pm

Questions about Events Adding notification to Content Edit

Post by dmgd »

CMS Made Simple 1.0.4 "Lanai"
Apache Version Apache/1.3.37 (Unix) PHP/4.4.4 mod_throttle/3.1.2 FrontPage/5.0.2.2635 mod_psoft_traffic/0.2 mod_ssl/2.8.28 OpenSSL/0.9.7a

I want to email a group in the event content has been added deleted edited.  I thought  Events should handle this. I searched and found this article
http://forum.cmsmadesimple.org/index.php/topic,6041.0.html

If I follow the thread,  I could use event ContentEditPost  and add a UDT to email a group  that content had been edited and supply the page id.  Is this possible?  Has anyone accomplished this?

Thanks Mark
Last edited by dmgd on Wed Feb 28, 2007 3:20 pm, edited 1 time in total.
Mark
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Questions about Events

Post by calguy1000 »

Yes, you should be able to do exactly this in a UDT.  You'd want to do a print_r( $params ); in your UDT (before sending the email) to see what variables, etc, are available to use.

This exactly the type of stuff events are designed for.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
dmgd
Forum Members
Forum Members
Posts: 115
Joined: Tue Jun 06, 2006 1:10 pm

Re: Questions about Events

Post by dmgd »

Thanks Calguy. I have a couple of question.
1)  How do I just get 1 params? I tried $params[ 'varname' ] and $params[ 'content' ][ 'varname' ], but no luck.  I admit I am no where near php expert but it seemed pretty straight forward.  What am I missing. The params I see with print_r($params) are

Code: Select all

Array
(
    [content] => content Object
        (
            [mId] => 22
            [mName] => Layout Options
            [mType] => content
            [mOwner] => 1
            [mProperties] => contentproperties Object
                (
                    [mPropertyNames] => Array
                        (
                            [0] => content_en
                        )

                    [mPropertyTypes] => Array
                        (
                            [content_en] => string
                        )

                    [mPropertyValues] => Array
                        (
                            [content_en] =>  REMOVED FOR READABILITY
                        )

                    [mAllowedPropertyNames] => Array
                        (
                            [0] => content_en
                        )

                )

            [mPropertiesLoaded] => 1
            [mParentId] => -1
            [mOldParentId] => -1
            [mTemplateId] => 17
            [mItemOrder] => 3
            [mOldItemOrder] => 3
            [mMetadata] => 
            [mTitleAttribute] => 
            [mAccessKey] => 
            [mTabIndex] => 
            [mHierarchy] => 00003
            [mIdHierarchy] => 22
            [mHierarchyPath] => layout-options
            [mMenuText] => Layout Options
            [mActive] => 1
            [mAlias] => layout-options
            [mOldAlias] => layout-options
            [mCachable] => 1
            [mPreview] => 1
            [mShowInMenu] => 1
            [mDefaultContent] => 
            [mMarkup] => html
            [mLastModifiedBy] => 1
            [mCreationDate] => 2007-02-03 06:47:47
            [mModifiedDate] => 2007-02-28 08:56:27
            [mAdditionalEditors] => Array
                (
                )

            [mReadyForEdit] => 1
            [additionalContentBlocks] => Array
                (
                )

            [addtContentBlocksLoaded] => 1
            [mChildCount] => 0
        )

)
2) If I make an edit and click Submit and not Apply the UDT is not run.  This may not be the way to do this anyway.
Mark
Acornweb

Re: Questions about Events Adding notification to Content Edit

Post by Acornweb »

Hmmm, I can't even get that far.

I'm trying to write a bridge between frontEndUsers and Vanilla forum.

I had it working by editing the module directly, but something is failing when users make an error in their login (the page returns null) - I'm trying events now to do it properly.

I've written a UDT and linked it to the FEU event "onLogin" - all the UDT is is an echo statement followed by a  print_r( $params );

I don't get any output to screen, so how do I know the UDT is even being called?

From reviewing the code I see that params will only include username and ip address, when I really need password as well. I guess I will have to edit the PHP module after all.
bladenet

Re: Questions about Events Adding notification to Content Edit

Post by bladenet »

I'm not sure if this is exactly what you need, but it will probably help.
From the Developers FAQ:

Can I access a module from within a plugin?

I'm writing a plugin or a UDT (User Defined Tag), and I'd really like to be able to interface with the XYZ module. How do I go about it?

Answer: Yes, via $gCms->modules

A list of all of the installed modules (at least those that have frontend functionality) is available in the global $gCms object. You can access that object like this:

Code: Select all

 
  global $gCms;
  if( !isset( $gCms->modules['TheModuleIWant'] ) || !isset( $gCms->modules['TheModuleIWant']['object'] ) )
    {
       return;
    }
  $themoduleiwant = $gCms->modules['TheModuleIWant']['object'];
  $themoduleiwant->DoThis($somedata);
  $themoduleiwant->DoThat($somemoredata);
This may not be the best way to handle it, as you're not sure if you're accessing a module that has or has not been installed yet, etc. but it's close enough to get you started. You can always use var_dump and print_r on the various portions of the $gCms object to see what is available.
Post Reply

Return to “CMSMS Core”