WordPress.org

Support

Support » Plugins and Hacks » Optional Content » [Plugin: Optional Content] Please help – specific user only not working?

[Plugin: Optional Content] Please help – specific user only not working?

  • I installed the Optional Content plugin and I want to display specific content for a specific user.

    When using the plugin, I clicked the [i] button in my toolbar, then clicked ‘Only to specific user’ and then chose the username (example: bob45 – user id is (6)). Then I click OK and the following appears in my visual editor:

    [optional_content type=” ]
    Content here
    [/optional_content]

    I asked someone about it and they said it seems like it’s broken because it used to work and now it’s not working for them either.

    Could someone please help me?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey Tony, in “plugins\optional-content\tinymce_plugin.js” starting on line 46 remove this section of code :

    else if(type == 'user-id'){
    		jQuery(".oc_field").hide();
    		jQuery("#users_grp").show();
    	}

    and then on line 169 that looks like this :

    <option><?php echo $user->user_login . " (" . $user->ID . ")"; ?></option>

    change it to this :

    <option value="<?php echo $user->ID ?>"><?php echo $user->user_login . " (" . $user->ID . ")"; ?></option>

    That should fix that little piece of functionality for you 🙂

    Seems that w/WP 3.1.2 this plugin is leaving out some code when you try and hide content based on username. The full first line needs to be:

    [optional_content type=’user-id’ value=’1′ ]

    where ‘1’ is the number next to the username.

    Hope that helps — the above fix didn’t work for me as the code was completely different.

    Wow that worked thanks… Nice going Paul!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Optional Content] Please help – specific user only not working?’ is closed to new replies.
Skip to toolbar