Wie kommt der Link da hin? Nach Integration oder von Hand?
Das ist ein einem anderen Thread elegant gelöst:
http://forum.wordpress-deutschland.org/buddypress/564…-und-forum.html
Mir ging es nur darum die Aktivität dieses einen Forums und der User darin in Buddypress ebenso darzustellen wie auch, wenn ein Nutzer einen Kommentar schreibt. Gibt es denn dafür auch eine Möglichkeit?
Ich habe da leider auch kein Patentrezept parat. Habe aber ein ähnliches Problem, geteiltes Leid ist halbes Leid also - so ungefähr könnte es gehen:
Im Trunk von Buddypress (für 1.1) hat sich anscheinend einiges getan in Richtung Actitity Stream. (siehe http://testbp.org/) - im Prinzip ist das nur ein Hook den du aufrufen müsstest wenn eine von dir Gewünschte Tätigkeit im Forum stattfindet. Es müsste auch nicht so schwer sein noch eine Spalte für Forum hinzuzubauen aber da habe ich mir den Code noch nicht angesehen.
bbpress vernünftig in Buddypress zu integrieren ist offensichtlich leider nicht so einfach - die besten Tutorials dazu ist IMHO diese:
http://umwblogs.org/wiki/index.php…ss,_and_bbPress
(allgemein)
http://labs.b5media.com/blog/creating-the-anypress-solution/
(links zu user profilen und ähnliches)
Damit kannst du die Hooks von Buddypress auch in bbpress nutzen. (Sogenannte Deep-Integration)
damit kannst kannst du eine buddypress Actity auslösen wenn jemand postet, das ganze könntest du als Plugin gestalten schau dir z.B. mal die Activity Sachen in der Buddypress-Skeleton Komponente an:
http://svn.wp-plugins.org/buddypress-ske…/bp-example.php
/**
* bp_example_record_activity()
*
* If the activity stream component is installed, this function will record activity items for your
* component.
*
* You must pass the function an associated array of arguments:
*
* $args = array(
* 'item_id' => The ID of the main piece of data being recorded, for example a group_id, user_id, forum_post_id
* 'component_name' => The slug of the component.
* 'component_action' => The action being carried out, for example 'new_friendship', 'joined_group'. You will use this to format activity.
* 'is_private' => Boolean. Should this not be shown publicly?
* 'user_id' => The user_id of the person you are recording this activity stream item for.
* 'secondary_item_id' => (optional) If the activity is more complex you may need a second ID. For example a group forum post needs the group_id AND the forum_post_id.
* 'secondary_user_id' => (optional) If this activity applies to two users, provide the second user_id. Eg, Andy and John are now friends should show on both users streams
* 'recorded_time' => (optional) The time you want to set as when the activity was carried out (defaults to now)
* )
*/
function bp_example_record_activity( $args ) {
if ( function_exists('bp_activity_record') ) {
extract( (array)$args );
bp_activity_record( $item_id, $component_name, $component_action, $is_private, $secondary_item_id, $user_id, $secondary_user_id, $recorded_time );
}
}
Alles anzeigen
Die Funktionen für Foren-Activity sind ja schon in Buddypress - allerdings im Groups-Plugin
http://trac.buddypress.org/browser/tags/1.0.3/bp-groups.php
innerhalb der Funktion groups_record_activity() sowie groups_format_activity()
zum Beispiel:
/* hier fehlt was */
case 'new_forum_post':
/* hier fehlt was */
$user_link = bp_core_get_userlink($user_id);
$group_link = bp_get_group_permalink( $group );
$post_content = apply_filters( 'bp_the_topic_post_content', bp_create_excerpt( stripslashes( $forum_post['post_text'] ), 55, false ) );
$content = sprintf ( __('%s posted on the forum topic %s in the group %s:', 'buddypress'), $user_link, '<a href="' . $group_link . '/forum/topic/' . $forum_topic['topic_id'] . '">' . $forum_topic['topic_title'] . '</a>', '<a href="' . $group_link . '">' . $group->name . '</a>' ) . ' <span class="time-since">%s</span>';
$content .= '<blockquote>' . $post_content . '</blockquote>';
$content = apply_filters( 'bp_groups_new_forum_post_activity', $content, $user_link, $group_link, $forum_topic['topic_id'], $forum_topic['topic_title'], $group_link, $group->name, $post_content );
return array(
'primary_link' => $group_link,
'content' => $content
);
}
Alles anzeigen
zusammen mit bp_activity_record() sollte das so klappen.
Dies könnte man du als Grundgerüst für ein bbpress-Plugin nehmen - du müsstest die Post-Funktion von bbpress überschreiben, wie das geht kannst du dir anhand des Bozo-Plugins ansehen:
function bb_bozo_new_post( $post_id ) {
$bb_post = bb_get_post( $post_id );
if ( 1 < $bb_post->post_status )
bb_bozon( $bb_post->poster_id, $bb_post->topic_id );
$topic = get_topic( $bb_post->topic_id, false );
if ( 0 == $topic->topic_posts )
bb_delete_topic( $topic->topic_id, 2 );
}
add_action( 'bb_new_post', 'bb_bozo_new_post', 5 );
Alles anzeigen
http://trac.bbpress.org/browser/trunk/bb-plugins/bozo.php
Da wird der Hook bb_new_post verändert, analog dazu kannst für dein eigenes Plugin dort die Buddypress Activity aufrufen.
Also:
1. bbpress Integration
2. "Deep Integration"
3. Funktion für die Buddypress-Activity Streams schreiben (alle nötigen Variablen mit vernünftigen Werten aus bbpress füllen
4. Diese Funktion bei den Tätigkeiten ausführen (Neuer Post etc.pp)
Absolut ohne Gewähr - bin kein PHP-Programmierer aber irgendwie sollte es in dieser Richtung lösbar sein. Vielleicht kann jemand mit mehr Erfahrung beschreiben ob dies der richtige Weg ist.
Das ganze ist warscheinlich doch richtig viel Arbeit - schaue dir mal die Skeleton-Komponente von Buddypress an und versuche nachzuvollziehen wie die Activities erzeugt werden. Eventuell könnte man damit auch ein Plugin bauen was bbpress etwas tiefer in Buddypress integriert.
Vielleicht hat sich mit Buddypres 1.1 auch etwas dahingehend getan?
Ich hoffe ich habe jetzt nicht für totale Verwirrung gesorgt.
PS: Mit der "Deep Integration" Scheint auch die Deutsche Sprache flöten zu gehen obwohl das eigentlich gefixt sein sollte - gibts hierfür schon abhilfe?