juanmaguerrero
Forum Replies Created
-
Hi, @ellbristow I’m not really the thread author and think that’s why I don’t find a link to “close thread” or something like that. It seems that the original thread creator hasn’t looked at this since long ago… ??
Hi, @jrgiblette, well you have to basically replace the parts that I pasted here starting from (around):
“THIS IS WHERE WE ACTUALLY SAVE THE ACTIVITY UPDATE”…It is an example of course, I made that when users post videos or links or photos, it has a different html class attribute instead of the default, and that “new different types” of activity also get registered in the database, so the system can understand that, for example: “activity item id: 123 –> has “x” content –> and it’s type is “bp_share_video”.
With this, below, I tweak the way the activities are shown, for example I can make the system to output “USERNAME has shared a video!!!” instead of the standard “USERNAME posted an update” text string.
Well, you have to of course modify my example to suit your needs, and this will work for all activity items created from the moment you applied it an so on, not backwards (although you of course can always tweak the database ?? ).
Let me know in which instance you are stuck, in the implementation, in tweaking my code, when you test what is the error that you see… so I can help further.
Cheers,
-JM
Thanks! I must say I corrected lots of “bugs” for saying, maybe if the developers of this plugin would like me to send “my” copy of bp activity plus” for taking a look at it and maybe find some useful corrections just let me know or drop me an email at juanmaguerrero.com [at] gmail [dot] com ?? cheers!
Ok, I’ve completely done it ?? This is the code:
/** * THIS IS WHERE WE ACTUALLY SAVE THE ACTIVITY UPDATE. */ function ajax_update_activity_contents () { $bpfb_code = $activity = ''; $aid = 0; $codec = new BpfbCodec; if (@$_POST['data']['bpfb_video_url']) { $bpfb_code = $codec->create_video_tag($_POST['data']['bpfb_video_url']); $type = 'bpfb_share_link'; } if (@$_POST['data']['bpfb_link_url']) { $bpfb_code = $codec->create_link_tag( $_POST['data']['bpfb_link_url'], $_POST['data']['bpfb_link_title'], $_POST['data']['bpfb_link_body'], $_POST['data']['bpfb_link_image'] ); $type = 'bpfb_share_link'; } if (@$_POST['data']['bpfb_photos']) { $images = $this->move_images($_POST['data']['bpfb_photos']); $bpfb_code = $codec->create_images_tag($images); $type = 'bpfb_share_wall_photos'; } $bpfb_code = apply_filters('bpfb_code_before_save', $bpfb_code); // All done creating tags. Now, save the code $gid = (int)@$_POST['group_id']; if ($bpfb_code) { global $bp; $content = @$_POST['content'] . "\n" . $bpfb_code; $content = apply_filters('bp_activity_post_update_content', $content); $user_id = $bp->loggedin_user->id; $userlink = bp_core_get_userlink( $user_id ); $author = bp_core_get_userlink( $author_id ); $activity_url = bp_activity_get_permalink( $item_id ); $aid = $gid ? groups_post_update(array('content' => $content, 'group_id' => $gid)) : // Acá intercepto el envío y lo customizo para poder discriminar tipos diferentes de actividad =D @Juanma //bp_activity_post_update(array('content' => $content)) bp_activity_add( array( 'action' => apply_filters( 'activity_update', sprintf( __( '%s compartió un enlace', 'buddypress' ), $userlink ), $user_id ), 'content' => $content, 'component' => 'activity', 'type' => $type, 'user_id' => $user_id ) ) ;
And below also added the activity filters options ?? (still a bit hardcoded but):
/** * bpfb_activity_links_filter() * * Adds 'Enlaces' and 'Wall Photos' to activity stream filters. * */ function bpfb_activity_links_filter() { echo '<option value="bpfb_share_link">Enlaces</option>'; echo '<option value="bpfb_share_wall_photos">Fotos del muro</option>'; } add_action( 'bp_activity_filter_options', 'bpfb_activity_links_filter' ); add_action( 'bp_member_activity_filter_options', 'bpfb_activity_links_filter' ); add_action( 'bp_group_activity_filter_options', 'bpfb_activity_links_filter' );
Hope it helps you also, @jchew ??
Ok, I’m making some advance, I changed the function that saves the activity ( /lib/class_bpfb_binder.php ):
// All done creating tags. Now, save the code $gid = (int)@$_POST['group_id']; if ($bpfb_code) { global $bp; $content = @$_POST['content'] . "\n" . $bpfb_code; $content = apply_filters('bp_activity_post_update_content', $content); $user_id = $bp->loggedin_user->id; $aid = $gid ? groups_post_update(array('content' => $content, 'group_id' => $gid)) : //bp_activity_post_update(array('content' => $content)) bp_activity_add( array( 'content' => $content, 'component' => 'custom_name', //this is the custom activity record 'type' => 'custom_name', //this is the custom activity record 'user_id' => $user_id ) ) ;
Indeed that is much needed! That would be great. I have tweaked this plugin a lot, improving it amazingly (look for example in my dev test site, the way the images look ?? https://www.soysurfista.com/miembros/admin/activity/173 ) ando a lot of other stuff. But yet I could not figure out were I could send a different activity type in the “posting the update” process… if you can give us a clue it would be great… thanks for everything!
This comment has the only purpose of letting me unsuscribe from this topic vía email ??
Oh I just solved it! ??
I passed it like this:
$pfs = new PostFromSite(0,'',false, $cat); $pfs->form();
Thanks for your help and without your previous posts I could have never reached the solution ??
Hi, rt49andellis, thanks a lot for your help. As far as I understand your first method uses the shortcode and I think I cannot use it like that from within a PHP file, is that right? That is why I opted for inserting it vía php tag.
The other one is the one I tried:
$postarr['post_category'] = array($id);
But I don’t know why the variable $id does not gets inside that part, it outputs as “null” ??
I’m putting the form from within a php template file, and through that same file I get the category id I need…
Maybe you can help me achiee this, I’m so glad you can give me a hand, thanks a lot!
Oh, I just read from https://me.redradar.net/2012/01/10/post-from-site-3-0/ that “Known Issue: Specifying category to post to is not working” :S ???
But you seem to solved it… or were you using an old version?
Hi! Can you help me? I want to specify a category that comes from a variable, so that the published post is assigned only to that specific category.
I get the category in the template I’m calling the form vía php (not shortcode).
I manage to get the category I want getting it from the slug like this:
$idObj = get_category_by_slug($cat_slug); $id = $idObj->term_id;
Then I tried:
$postarr['post_category'] = array($id);
But the variable does not seems to get there in the form ??
Can it be achieved sending a parameter here?:
$pfs = new PostFromSite(0,'',false); $pfs->form();
Thanks a lot!!!
@mercime said 20 hours, 28 minutes ago:
== Doest it needs Multisite feature enabled? ==
@juanmaguerrero BP Groupblog requires multisite.
If you want to simulate group blog in single WP installation, use https://buddydev.com/plugins/blog-categories-for-groups/ with https://buddydev.com/plugins/bp-simple-front-end-post/ for front end posting.juanmaguerrero said 2 hours, 26 minutes ago:
@mercime, that is EXACTLY what I needed. Thanks!!!! ??This conversation took place at https://buddypress.org/community/groups/creating-extending/forum/topic/buddypress-groupblog/
Do you need BP Multisite for this plugin to work???
I have the same problem, I’m currently running the latest WP/BP installs and have activated and moved the themes but can’t find admin panel options nor frontend “in-group” options… any help? Thanks!
Forum: Fixing WordPress
In reply to: mysql database export, and the accursed ?@gm22 I had the same problem and it solved it!!! Works as magic!!! Thanks a lot!!!