latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Removing Admin Meta Box – Old Fixes Broken

Home Forums Community Forum Removing Admin Meta Box – Old Fixes Broken

This topic contains 14 replies, has 3 voices. Last updated by  Cristián Lávaque 4 years, 6 months ago.

Topic Author Topic
Posted: Tuesday Jul 3rd, 2012 at 7:35 pm #18234

I found this solution:

http://www.primothemes.com/forums/viewtopic.php?f=4&t=10399&view=unread
But it does not work, perhaps S2Member has been updated since then?

Unchecking s2Member from the Screen Options for the edit page only changes my view, not customers (we allow customers limited access to the admin area.)

Any help is greatly appreciated.
Thanks!

List Of Topic Replies

Viewing 14 replies - 1 through 14 (of 14 total)
Author Replies
Author Replies
Posted: Wednesday Jul 4th, 2012 at 7:55 am #18277

Hi Tony.

Sorry, I had a mistake in my code there. Try this please:

/wp-content/mu-plugins/s2hacks.php
Knowledge Base » Hacking s2Member® Via Hooks/Filters
[hilite pre_code]

Posted: Wednesday Jul 4th, 2012 at 11:49 am #18304

Hi Cristián

Thank you for the quick reply. I tried the new code and the meta box still shows for S2Member levels. I created a folder in the plugin directory and created a file with this code inside. Permissions on the folder are 755 and file is 644. Am I missing something?

Tony

Posted: Wednesday Jul 4th, 2012 at 11:06 pm #18326

Not in the plugins directory, but the must-use plugins directory. /wp-content/mu-plugins/s2hacks.php ;)

Posted: Wednesday Jul 4th, 2012 at 11:52 pm #18333

Sorry, that was a silly mistake on my part. Now the s2hacks.phpfile is in /wp-content/muplugins but I get an error:
Parse error: syntax error, unexpected T_STRING in /public_html/wp-content/mu-plugins/s2hacks.php on line 6

Line 6 is:
remove_action (‘add_meta_boxes’, ‘c_ws_plugin__s2member_meta_boxes::add_meta_boxes’);

Tony

Posted: Thursday Jul 5th, 2012 at 12:44 am #18343

Sorry, was missing a parenthesis at the end of the [hilite mono]if[/hilite] line. It should be like this:

[hilite code] if (!current_user_is('administrator'))[/hilite]
Posted: Thursday Jul 5th, 2012 at 12:58 am #18344

Yes, that works perfectly. Thank you very much for such quick support!

Posted: Thursday Jul 5th, 2012 at 4:05 am #18356

You’re welcome! Thanks for your patience. Sorry I had those errors in my hack. But I’m glad it’s all working now. :)

Posted: Saturday Jul 7th, 2012 at 4:53 pm #18577

Cristian,
I tried using this code that you provided to remove the s2member restriction box on the “add new post” page. However, it did not work. I created the necessary mu-plugins directory under wp-content and named the file s2hacks.php

The error I receive is: Parse error: syntax error, unexpected ‘< ' wp-content/mu-plugins/s2hacks.php on line 18

The only thing on line 18 is

Please help as we are launching our website by the latest Monday morning.

Posted: Saturday Jul 7th, 2012 at 9:58 pm #18584

Hi Ed.

The hack doesn’t have that many lines. Do you have other things there? Could you post all the code in your s2hacks.php file? Please put it inside [hilite mono]<code>[/hilite] tags or it won’t display properly.

Posted: Saturday Jul 7th, 2012 at 10:16 pm #18588

I created a new php file in Dreamweaver. I tried it with and without <code>. Thank you for your help.

Here is the entire contents of the file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>

<?php
add_action ('plugins_loaded', 'remove_s2_meta_box');
function remove_s2_meta_box()
{
    if (!current_user_is('administrator'))
        remove_action ('add_meta_boxes', 'c_ws_plugin__s2member_meta_boxes::add_meta_boxes');
}
  • This reply was modified 4 years, 6 months ago by  Cristián Lávaque. Reason: Fix the code tags
Posted: Saturday Jul 7th, 2012 at 10:17 pm #18589

I was trying to say that I tried it with and without the code tags. Thank you for your help. I took the code exactly as it is presented from earlier in this post.

Posted: Saturday Jul 7th, 2012 at 10:37 pm #18593

I see. Please remove all the lines before the code I provided, you should just have the lines I posted earlier. And don’t use Dreamweaver, probably better if you just open it in Notepad.

Posted: Saturday Jul 7th, 2012 at 10:49 pm #18594

I copied just your code and pasted it into Notepad. It worked! I clicked on add new post as an Author and the restriction box was no longer there. It also wasn’t there when I checked the screen options which is great. As an Admin the s2 member restriction box by default wasn’t there either but if needed, a simple click on screen options and i could always bring it back on a per post basis for setting restriction levels. Thank you very much for such a quick turnaround and all of your help.

Posted: Saturday Jul 7th, 2012 at 11:35 pm #18595

Glad I could help. :)

Viewing 14 replies - 1 through 14 (of 14 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.