Support » Plugin: Sociable » [Plugin: Sociable] Uncheck “Sociable disabled?” not working

  • Resolved Seebz

    (@seebz)


    In sociable_insert_post() function, replace $post->ID by $pID (2 times)

    Edit: “quick edit” destroy this setting, better way :

    new sociable_insert_post() function :

    function sociable_insert_post($pID) {
    	if (isset($_POST['sociableoff'])) {
    		if($_POST['sociableoff']) {
    			if (!get_post_meta($pID,'_sociableoff',true))
    				add_post_meta($pID, '_sociableoff', true, true);
    		} else {
    			if (get_post_meta($pID,'_sociableoff',true))
    				delete_post_meta($pID, '_sociableoff');
    		}
    	}
    }

    new sociable_meta() function :

    function sociable_meta() {
    	global $post;
    	$sociableoff = false;
    	if (get_post_meta($post->ID,'_sociableoff',true)) {
    		$sociableoff = true;
    	}
    	?>
    	<input value="0" type="hidden" name="sociableoff" />
    	<input value="1" type="checkbox" id="sociableoff" name="sociableoff" <?php checked($sociableoff); ?>/>
    	<label for="sociableoff"><?php _e('Sociable disabled?','sociable') ?></label>
    	<?php
    }

Viewing 5 replies - 1 through 5 (of 5 total)
  • Can you explain what this does please?

    Also, is this supposed to be pasted into my functions.php?

    Thanks a lot. I was looking for that solution.

    I’ve suffered the same problem too in a recent project.

    In order to make Sociable work correctly you have to replace these two functions “sociable_meta” and “sociable_insert_post” in file “sociable.php” by the ones I’ve pasted below, and that’s it…Sociable will be deactivated or reactivated at your will. TESTED!!

    THE SOLUTION:

    Revised function sociable_meta:

    function sociable_meta($post) {
    	$sociableoff = false;
    	if (get_post_meta($post->ID,'_sociableoff',true)) {
    		$sociableoff = true;
    	}
    	?>
    	<input type="checkbox" id="sociableoff" name="sociableoff" <?php checked($sociableoff); ?>/>
    	<label for="sociableoff"><?php _e('Sociable disabled?','sociable') ?></label>
    	<?php
    }

    Revised function sociable_insert_post:

    function sociable_insert_post($pID) {
    	if ($_POST['sociableoff'] == 'on') {
    		add_post_meta($pID, '_sociableoff', true, true);
    	} else {
    		delete_post_meta($pID, '_sociableoff');
    	}
    }

    This solution works up to WordPress 3.0.1 using Sociable 3.5.2.

    Hope this helps!!

    Thanks for posting this solution. It works perfectly!

    Thank you! I was just having this problem and it’s fixed!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Sociable] Uncheck “Sociable disabled?” not working’ is closed to new replies.