Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Activity stream commenting (36 posts)

Started 3 months, 4 weeks ago by: Marcella

  • Profile picture of Marcella Marcella said 3 months, 4 weeks ago:

    Wondering if anyone has a step by step guide on how to enable activity stream commenting without AJAX?

    Having followed the instructions in /developer-docs/custom-buddypress-loops/the-activity-stream-loop/

    Still no joy. When submitting a comment it redirects the form submission to the url domain.com/activity/reply/

    Having compared the bp-default theme activity stream activity/post-form.php output to the this child theme there are no differences.

    Also, took a look at the the bp-default theme with JS disabled and looks like it doesn’t work under these conditions at all.

    Since activity/reply/ returns a 404 my knowledge peaks here without seeing which function runs. Any help would be immensely appreciated.

    Thanks

    *Edit* Also just noticed the edit forum topic form is missing some padding left and right here.

  • Profile picture of Marcella Marcella said 3 months, 4 weeks ago:

    *bump* help please :(

  • Profile picture of Marcella Marcella said 3 months, 3 weeks ago:

    *nudge*

  • Profile picture of Marcella Marcella said 3 months, 3 weeks ago:

    Have done some further digging and keep hitting the 404 issue.

    The same issue is effected when adding a user as a friend, joining a group and favoriting.

    Have created a quick and dirty button generator function that can be used throughout this WordPress theme.

    However with the dead landing page these will never work. Are there any other approaches considered a best practice?

  • Profile picture of Paul Gibbs Paul Gibbs said 3 months, 3 weeks ago:

    I’ve not seen any such guide, and since it would require someone to figure out it for you, you probably won’t get a quick response. I know one of the core developers of BuddyPress is keen on non -Ajax support, so if it doesn’t work in BPDefault, submit it as an issue to the BuddyPress trac.

  • Profile picture of Marcella Marcella said 3 months, 3 weeks ago:

    Thanks for the heads up, guess that’s all the clarification was needing.

    Do you know who worked on the activity streams? Maybe they’ll be able to share some inverse knowledge.

    Will take a look for this item in trac, and post solution if found.

  • Profile picture of Marcella Marcella said 3 months, 3 weeks ago:

    @djpaul it’s already in trac :)

    In ajax.php there is a function

    function bp_dtheme_new_activity_comment()

    On line 194

    check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );

    In activity/entry.php The Nonce matches here.
    <?php wp_nonce_field('new_activity_comment', '_wpnonce_new_activity_comment'); ?>

    In buddypress/bp-activity/bp-activity-functions.php Line 912
    function function bp_activity_new_comment()

    Which later calls on line 937

    bp_activity_add($args)

    $args being sent from the form.

    Within the same file there is the function above which preps the data by merging and ostracising into var names.

    It then used the BP_Activity_Activity class located in buddypress/activity/bp-activity-classes.php

    and checks if the data could not be saved otherwise return the id of the entry.

    BP_Activity_Activity instantiates all expected parameters initially with the id if passed. (i’m guessing for an output method).

    Saving is the issue here and the method save() on line 62 has 3 global vars $wpdb, $bp and $current_user.

    Saving allows for additional filters (to which extent is beyond me here) (… along with the rest).

    *gets hairier here

    Then…
    It checks if some specific filters failed to return a value and if so returns false.
    It checks for more specific filter return values and if false sets them to that of the matched user. (primary_link) specifically. How this is used in saving, can only hazard a guess that it’s for outputing a url to the activity stream for permalink.php

    http://site.com/members/admin/activity/6060842 for example.

    Then using WPDB inserts or updates accordingly.

    Maybe we can gain some movement with this here.

    Anyone else please do chime in with corrections of the above PSEUDO interpretation, where to go from here is the next one.

  • Profile picture of Marcella Marcella said 3 months, 3 weeks ago:

    Wondering if we can migrate the fore-mentioned into a single-file.php temporarily and set the activity entry form action to the current page and call accordingly? (Which totally goes against the DRY principles, jquery.delegate has its bugs too. ahhhh)

    Will give it a whirl tomorrow.

  • Profile picture of kalengi kalengi said 3 months, 3 weeks ago:

    Hey @Marcella, are you still stuck on this? If so, what’s the structure of your code/pages so far? I may be able to help…

  • Profile picture of allwest allwest said 3 months, 3 weeks ago:

    @Marcella You are way ahead of me in code but I am having the same trouble commenting on any posts using the defalut bp theme. just the form submission to the url domain.com/activity/reply/404 error.

    @kalengi Whats the best way to start?

  • Profile picture of allwest allwest said 3 months, 3 weeks ago:

    What about permalinks?
    Looks like I’m in Numeric and should be Default
    In Default commenting works
    But in Numeric they give me a page not found

  • Profile picture of Marcella Marcella said 3 months, 3 weeks ago:

    @kalengi – Hello, this is a child theme so the file structure adheres to anything in bp-default.
    So… accessing the stream via the url .

    site.com/activity

    using the file

    theme/activity/index.php

    Calling the loop from index.php

    theme/activity/activity-loop.php

    Calling an entry from within the loop

    theme/activity/entry.php

    Omitting header.php the full loop looks like this.

    <?php if(bp_has_activities('display_comments=threaded')) : ?>	
    
    	<?php while(bp_activities()) : bp_the_activity(); ?>
    
            <div class="activity-item"> 
    
    	        <?php bp_activity_content_body(); ?>  
    
    	        <?php if((is_user_logged_in() && bp_activity_can_comment()) || bp_activity_get_comment_count()) : ?>
    
    	        <form action="<?php bp_activity_comment_form_action(); ?>" method="post">
    	            <fieldset>
    			        <textarea name="ac_input_<?php bp_activity_id(); ?>"></textarea>
    			        <input type="submit" name="ac_form_submit" class="submit" value="<?php _e('Post', 'buddypress'); ?>" />
    			        <input type="hidden" name="comment_form_id" value="<?php bp_activity_id(); ?>" />
    			        <?php do_action('bp_activity_entry_comments'); ?>
    			        <?php wp_nonce_field('new_activity_comment', '_wpnonce_new_activity_comment'); ?>
    	            </fieldset>
    	        </form>
    	        <?php endif; ?>	        
    
            </div>
    
        <?php endwhile; ?>
    
    <?php endif; ?>

    That’s being sent to the 404.

    @allwest – I think this is a known issue, it’s listed over in Trac http://buddypress.trac.wordpress.org/ticket/3705

    `

  • Profile picture of rokugatsu rokugatsu said 3 months, 3 weeks ago:

    I have the same error when the users reply comments…what is solution? Thanks!

  • Profile picture of kalengi kalengi said 3 months, 3 weeks ago:

    @Marcella, I’ve posted code, but it’s not showing up so I guess there’s something I’m missing or it’s being held for moderation.

  • Profile picture of Marcella Marcella said 3 months, 3 weeks ago:

    Ah not sure man.