WordPress.org

Ready to get started?Download WordPress

Forums

BuddyPress Links
[resolved] Bug report / fix: Comments getting shown on wrong links (3 posts)

  1. JEPSONRAE
    Member
    Posted 1 year ago #

    The generate_cloud_id function in bp-links-classes.php generates an id which is incompatible with how buddypress stores item_ids (BIGINT) in the wp_bp_activity table. This results in that column often getting filled with 0 which means that comments are getting shared between all links with an item_id of 0.

    I've temporarily fixed this on my install by changing the md5 hash generation to a simple concatenation of rand(0,9999) + time() + rand(0,9999) to generate an integer no larger than 20 characters. This seems to have fixed the problem for me.

    Code as follows (line 298 of bp-links-classes.php):

    private function generate_cloud_id() {
    	global $bp;
    
    	if ( $this->url ) {
    		return rand(1,999) . time() . rand(1,999);
    	} else {
    		return false;
    	}
    }

    http://wordpress.org/extend/plugins/buddypress-links/

  2. MrMaz
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you for this report! I have been receiving some really bizarre complaints, and I think this explains them all. At some point they must have changed the schema for that table and I missed it.

    The cloud id thing never really turned into a feature, so I might just drop it completely by setting it to the same as 'id'.

    Let me know if you are interested in helping with development of the free plugin.

  3. MrMaz
    Member
    Plugin Author

    Posted 1 year ago #

    I just made a commit to core which keeps the cloud id, but stops using it in the activity table. I also added an upgrade routine which fires on activation that repairs existing activity stream items by comparing the link slug to the end of the primary_link in the activity table.

    https://github.com/PressCrew/buddypress-links/commit/9ad7d5d11f34e55a9e02ceee1ba9d10f24ba0bd1

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.