Jump to content

Archived

This topic is now archived and is closed to further replies.

sheilahoff

Hooker usage

Recommended Posts

sheilahoff

I'm more designer than developer so I'm new to hooks. I have been searching and reading but need some help. First off the thread I found suggested installed Action Map to help understand hooks. I cannot find it anymore. The link to it was bad. Is it still available for DMS?

 

I'm trying to do what this thread recommends in order to make the User Submission plug-in only available to logged in contributors. http://wordpress.org/support/topic/limiting-posts-to-registered-users?replies=11

 

I've tried to add the recommended php code in several different places using Hooker. But I guess either I don't know which hook to use or else this code doesn't work that way.

add_shortcode( 'member', 'member_check_shortcode' );

function member_check_shortcode( $atts, $content = null ) {
	 if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
		return do_shortcode($content);
	return '<p>Please register to add content.</p>';
}

The instructions then say to add [member][user-submitted-posts][/member] where I want the submission form hidden until logged in. The last place I tried it was before postloop. And all that does is display the code at the top of the page. Then it displays the form with the short code before and after it. Clearly I'm missing a step. Hopefully someone can set me straight.

 

Is there an easier/better way to do this or am I close and I just need the correct hook?

 

Site under dev using WP 3.8 and newest DMS: http://tca.hoffmangraphics.com/article-submission-form/

 

Thanks,

Sheila


Sheila Hoffman | Hoffman Graphics | Seattle

Share this post


Link to post
Share on other sites
greenfly

Hi Sheila 

 

The Action map is not part of the Pro Tools Plugin - you will find the checkbox to turn on Action map in the Plugin settings. 

 

Once activated the Action map toggle link is in the top left of your home page in the WP admin bar 

 

However, i don't think you need to use Hooker for this. 

 

The code is a Wordpress action and should be added to your Child Theme's functions.php file and then the shortcode is added to the page to tell Wordpress which page to use the action on. no need to add the shortcode anywhere specific using a hook - just in the body of the page.


The answer to many issues can be found by searching in the forum before posting as someone else  may very well have had the same problem before you have.  Also, reading the documentation can help you gain a good understanding of how everything works. 

 

Please do not send me private messages. Occam's razor - The principle states "Keep things simple!"

Share this post


Link to post
Share on other sites
sheilahoff

Brilliant Martin! I just needed to know where to add it is all. Works like a charm. And good to know the Action Map is now in the DMS Pro Tools. Thanks.


Sheila Hoffman | Hoffman Graphics | Seattle

Share this post


Link to post
Share on other sites
Danny

Happy to hear the issue has been resolved and I must say your topic title had me in stitches. :D


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

×