WordPress.org

Ready to get started?Download WordPress

Forums

Sociable
[resolved] Uncheck "Sociable disabled?" not working (6 posts)

  1. Seebz
    Member
    Posted 3 years ago #

    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
    }
  2. craigcac
    Member
    Posted 3 years ago #

    Can you explain what this does please?

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

  3. gniewosz
    Member
    Posted 3 years ago #

    Thanks a lot. I was looking for that solution.

  4. Tubal
    Member
    Posted 3 years ago #

    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!!

  5. silvergenes
    Member
    Posted 3 years ago #

    Thanks for posting this solution. It works perfectly!

  6. cheriak
    Member
    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags