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.

Use custom labels for for meta-box

Home Forums Community Forum Use custom labels for for meta-box

This topic contains 6 replies, has 2 voices. Last updated by  Patrix 3 years, 11 months ago.

Topic Author Topic
Posted: Sunday Jan 13th, 2013 at 2:29 am #37208
Patrix
Username: s.patrix

Hello,
How can I rename the levels labels in the meta-box when creating a new post/page in the admin?

My clients is confused by the level number “Require level N” / “Require Highest Level”

I found out that the file to change is probably meta-box-security.inc.php, but I’m not sure how to proceed.

Also it would be great if I could use a hack instead, so that the change would be not overwritten when updating the plugin.

Thanks for your help.

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Sunday Jan 13th, 2013 at 3:45 am #37220
Staff Member

Thanks for your inquiry.

~ We appreciate your patience :-)

I’m sorry but there is no s2Member hook/filter for this yet. You are correct about having found the right file to modify however. Modifying the code in that file would achieve that for you. Unfortunately, those changes would be wiped out during a future upgrade of the software.


Related to this, is a feature that can help you in other areas of the Dashboard. This will not change those labels in the drop-down menu, but it is related, so I’ll post it here anyway, just in case it helps someone.

See: Dashboard -› s2Member® -› General Options -› Membership Levels/Labels

Posted: Sunday Jan 13th, 2013 at 3:55 am #37223
Patrix
Username: s.patrix

Hi Jason,
Thank you for the response, and for your help.

Ok, no problem, I’m willing to save the file and re apply the changes when it’s time to update :)
I would really appreciate if you could help me figuring this out, (if it is not too complicated)

I changed the default line with:

echo '<option value="">Free to Everyone</option>'."\n"; /* By default, we allow public access to any Post/Page. */

and that’s the easy part…

But what about the dynamic levels? How can I get the names instead of the numbers?

Thanks again.

Posted: Sunday Jan 13th, 2013 at 10:44 am #37250
Staff Member

Thanks for the follow-up :-)

You can access this via PHP using the s2Member global options array.

Posted: Sunday Jan 13th, 2013 at 4:02 pm #37302
Patrix
Username: s.patrix

Thanks again for helping me on this.

I still have an issue, now I have duplicated levels (for the same level value), because this part of the code is still getting the dynamic levels.

for($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
													echo ($pages[$n] !== array("all")) ? /* Protecting `all` Pages, of any kind? */
													((!in_array("all-pages", $posts[$n])) /* Protecting Posts of type: `page` ( i.e. `all-pages` )? */
													? '<option value="'.$n.'"'.((in_array($page_id, $pages[$n])) ? ' selected="selected"' : '').'>'.(($n === $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]) ? 'Require Highest Level #'.$n : 'Require Level #'.$n.' ( or higher )').'</option>'."\n"/**/
													: '<option value="" disabled="disabled">Level #'.$n.' ( already protects "all" Posts of this type )</option>'."\n")/**/
													: '<option value="" disabled="disabled">Level #'.$n.' ( already protects "all" Pages )</option>'."\n";
												/**/

Any fix for this?

Thanks a lot! :)

Posted: Monday Jan 14th, 2013 at 7:34 am #37344
Staff Member

Thanks for the follow-up :-)

I’m not sure what you mean by “duplicate”, sorry. Please feel free to elaborate so that I understand better.

I would suggest something like this…

for($n = 0; $n <= $GLOBALS&#91;"WS_PLUGIN__"&#93;&#91;"s2member"&#93;&#91;"c"&#93;&#91;"levels"&#93;; $n++)
	echo ($pages&#91;$n&#93; !== array("all")) ? /* Protecting `all` Pages, of any kind? */
	((!in_array("all-pages", $posts&#91;$n&#93;)) /* Protecting Posts of type: `page` ( i.e. `all-pages` )? */
	? '<option value="'.$n.'"'.((in_array($page_id, $pages&#91;$n&#93;)) ? ' selected="selected"' : '').'>'.(($n === $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]) ? 'Require '.$GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_label'] : 'Require '.$GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_label'].' ( or higher )').'</option>'."\n"/**/
	: '<option value="" disabled="disabled">Level #'.$n.' ( already protects "all" Posts of this type )</option>'."\n")/**/
	: '<option value="" disabled="disabled">Level #'.$n.' ( already protects "all" Pages )</option>'."\n";

That’s about as far as I can go on custom coding. I’ll be happy to provide you with more leads on where to find certain things, or to share ideas with you, but I can’t debug any custom code that you write. Please see: s2Member® » Support Policy » Within Scope for some clarification on this. Thanks!

Posted: Tuesday Jan 15th, 2013 at 1:57 pm #37617
Patrix
Username: s.patrix

Hey Jason,

Well, it perfectly works now!! That’s exactly what I needed.

Now the Admin box, shows the name of my custom levels.

Thanks again for your help!!

Viewing 6 replies - 1 through 6 (of 6 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.