Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'group_id'

Viewing 25 results - 526 through 550 (of 564 total)
  • Author
    Search Results
  • #57918
    Andy Peatling
    Keymaster

    You should make it a plugin, then add this to the plugin and activate. If you’d like to see a working implementation then check out these plugins:

    https://wordpress.org/extend/plugins/buddypress-group-twitter

    https://wordpress.org/extend/plugins/bp-groupblog

    https://wordpress.org/extend/plugins/external-group-blogs

    You should be saving extra group information as groupmeta:

    bp_groups_update_groupmeta( $group_id, 'name', $value );

    #57761
    Andy Peatling
    Keymaster

    $group_id = BP_Groups_Group::group_exists($group_slug)

    Not technically named for what you want to do, but it does the job. I will add a better named function for this.

    #56897
    Philipp
    Participant

    Hi and thanks al lot for you answers!

    So it’s not enoght to change the code like this:

    <?php if ( function_exists( ‘bp_has_profile’ ) ) : if ( bp_has_profile( ‘profile_group_id=2’ ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

    Shall I write:

    <input type=”hidden” name=”signup_profile_field_ids” id=”signup_profile_field_ids” value=”<?php echo $all_pf_fields;?>” />

    or:

    <input type=”hidden” name=”signup_profile_field_ids” id=”signup_profile_field_ids” value=”1,2,3,4,5″ />

    I’m very sorry, but I didn’t get what you mean with the Profileloop. It would be so glad if you could write what to change or to ad excactly…

    Thanks a lot!

    Philipp

    #56867
    Brajesh Singh
    Participant

    hi Phillip

    Yes yo can.

    By default your registration page will show only the fields from first profile field group.

    You can change it.

    You will have to edit registration/register.php

    Look for the code

    bp_has_profile( 'profile_group_id=1' )

    and replace it with

    bp_has_profile( )

    Now your register page will show all the fields.

    But stop,This is not enough,you need to aggregate all the field ids and put it as hidden field.

    So Take a look at the the line

    <input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php bp_the_profile_group_field_ids() ?>" />

    remove it from the profile loop.Now create some code inside the profile loop,aggregate all profile ids and then

    put this code outside the profile group loop,

    where I ssume you have aggregated all profile fields in the variable $all_pf_fields.

    <input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php echo $all_pf_fields;?>" />

    Please note,all $all_pf_fields should be the comma separated list of all profile ids(say 1,2,3,)

    This will make it work,and your registration page will show all profile groups fields

    #56866
    Simon Dabkowski
    Participant

    Each field group has an ID value. You can modify the registration.php file to include additional groups by repeating the following and changing “1” to “2”:

    <?php if ( function_exists( ‘bp_has_profile’ ) ) : if ( bp_has_profile( ‘profile_group_id=1’ ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

    to

    <?php if ( function_exists( ‘bp_has_profile’ ) ) : if ( bp_has_profile( ‘profile_group_id=2’ ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

    #56130
    Sven Lehnert
    Participant

    In the moment, I do what Andy has offered above.

    Members:

    <?php echo bp_core_fetch_avatar(
    'item_id=' . get_the_author_id() . '&type=full&width=100&height=100' ) ?>

    Groups:

    <?php echo bp_core_fetch_avatar( 'item_id=' . bp_get_the_site_group_id()
    . '&object=group&type=full&width=100&height=100' ) ?>

    Just I think this is the same as doing it in the css.

    I like to know how to change the original size at the moment when its created.

    But I don’t want to define these with custom values in wp-config.php.

    I’m looking for a solution to have control of the Avatar size in custom components.

    for example: In the bp-events Plugin, I would like to change the Avatar format to a Flyer format.

    Most of the Event Flyer, people want to upload, do not feed the Avatar size from Buddypress.

    So they just get a cuted piece of there flayer.

    I relay would like to change this.

    #55584

    Odd, because in order for the avatar to upload correctly, it needs to be created by being provided a group_id. Is your avatar uploaded and displayed correctly? Technically the group is created after the first step, and the subsequent steps only serve to fill in the settings and options.

    #55454
    dpolant
    Participant

    I don’t think there is a bpcontents template tag that outputs an item id in the loop.

    I assume you’re trying to access this value in a place where $oci_items_template has been defined, and so I think the fastest way to get it is to call global $oci_items_template and then get $oci_items_template->item->id.

    If on the off chance you have a group_id or user_id to feed in, oci_get_member_item_id() and oci_get_group_item_id() will return (not output) an item id from a group or user id. That’s about the best I can do but I bet that’s not what you’re looking for.

    So like you said, you’re probably going to want to write your own template tag to do this.

    I tried to contact Burt about a month ago and haven’t heard back yet – I heard he might be working on a new version of bpcontents but I don’t know anything definite.

    One word of warning – at least in my case, the 1.1 upgrade totally broke down bpcontents. It wasn’t too hard to get it working again but required about half a day of debugging. If you’ve got bpcontents running in 1.1 + without hacks I’d be very interested to hear how you did it.

    #54337
    Paul Wong-Gibbs
    Keymaster

    Aloha. You can use this for starters:

    function df_xprofile_filter_link_profile_data( $field_value, $field_type = 'textbox' ) {
    global $bp, $field;

    remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 2, 2 );

    if ( 1 == $field->group_id && 'Name' == $field->name )
    return 'change this to whatever you want';
    else
    return xprofile_filter_link_profile_data( $field_value, $field_type );
    }
    add_filter( 'bp_get_the_profile_field_value', 'df_xprofile_filter_link_profile_data', 1, 2 );

    This is edited from what I’m using for so not guaranteed to work first time.

    Peter Kirn
    Participant

    Hi John – thanks for the detailed response. I did read the documentation. The problem is – and I didn’t realize this until after my first attempt at the upgrade was finished – that documentation doesn’t appear to cover the scenario of an existing, integrated bbPress setup with bbPress stored in a *different* database. So, initially, I tried to choose the existing installation. When that didn’t work, I went back into admin and chose the option that allows you to try again with a fresh installation. What I’m trying to fix now is a *new* bbPress installation – but with existing groups.

    Certainly, what you describe makes absolute sense. So now, I’m just looking for a resolution. I’m not concerned about existing forum posts; I think we can start fresh.

    I’m looking now at the database. In wp_bp_groups_groupmeta, I see id and group_id.

    In wp_bp_groups, I see id and enable_forum.

    But enable_forum is the boolean for that checkbox. I don’t see where the forum_id is stored; it’s not listed as a field in either of those tables. Do I need to look at the bbpress table? How is the forum id matched up with the group id, since that seems to be the issue? Presumably if I delete the fields for that metadata, then disable the forum option for each of the groups, then re-enable, it should create new forums, yes? But where do I find that forum ID metadata, or can I actually simply delete the metadata for each of the groups that has a forum?

    I recommend reading https://codex.buddypress.org/developer-discussions/buddypress-forum/ if you haven’t already…

    Peterkirn, did you choose a new installation or an existing one when you updated?

    Here’s what’s happening, and how to fix it.

    Since you picked new installation, your existing groups forums won’t work, because the forum_id’s they want to post to don’t exist in your new installation.

    Basically, New installation = New database tables

    If your old forums don’t have any important or relevent topics, or any at all, go back and forth between your “wp_bp_groups” table and your “wp_bp_groups_groupmeta” table, and remove the groupmeta entries with the group_id’s of your existing groups, that have any forum_id.

    When you disable and enable the forums, it isn’t creating a new forum for them, it’s just turning off the ability. If you created a forum for an old group, and then create a new installation, the new database tables will be empty and your BuddyPress forums will look at those tables for data. If you use an existing installation, then BuddyPress will continue to use the old bbPress tables and allow an external bbPress installation to access them on its own, while letting the bbPress included with BuddyPress use it for its own purposes.

    #52669
    Andy Peatling
    Keymaster

    Ok the problem is retroactive. Before recent versions, group wire posts were recording the wire_post_id as the primary ID in the activity stream, and not the group_id. This means the filter is picking up wire posts with the same ID as the new group.

    There is really no way to fix this, it will not happen moving forward. Your best bet is to delete any activity that is not correct. It should be rare, and very limited – only one item in most cases.

    #51446
    peterverkooijen
    Participant

    This works:

    function synchro_mailinglist($user_id, $password, $meta) {
    global $bp, $wpdb;

    $email = $wpdb->get_var("SELECT user_email FROM $wpdb->users WHERE ID='$user_id'");

    $fullname = $meta[field_1];
    $space = strpos( $fullname, ' ' );

    $company = $meta[field_2];

    if ( false === $space ) {
    $firstname = $fullname;
    $lastname = '';
    } else {
    $firstname = substr( $fullname, 0, $space );
    $lastname = trim( substr( $fullname, $space, strlen($fullname) ) );
    }

    $firstname = nameize($firstname);
    $lastname = nameize($lastname);

    ...

    $wpdb->query("INSERT mailingusers SET users_id='$user_id', group_id='1', signup_date= UNIX_TIMESTAMP(), firstname= '$firstname', lastname= '$lastname', email_address = '$email' ");
    $wpdb->query("INSERT mailingcdata SET cdata_id=NULL, user_id='$user_id', cfield_id='1', value='$company'");

    }
    add_action( 'wpmu_activate_user', 'synchro_mailinglist', 10, 3);

    I used it as part of this function. This should work other mailinglist scripts as well, just change the table and field names.

    I don’t understand why $user_email didn’t work. I had to pull the user_email from the database. Is there a cleaner way?

    #51411
    peterverkooijen
    Participant

    I’m now trying to add firstname, lastname and email address straight to the database tables of my mailing list. I’ve added the queries to the function I had put together here:

    function synchro_wp_usermeta($user_id, $password, $meta) {
    global $bp, $wpdb;

    ...

    $wpdb->query("INSERT mailingusers SET users_id='$user_id', group_id='1', signup_date= UNIX_TIMESTAMP(), firstname= '$firstname', lastname= '$lastname', email_address= '$user_email'");
    $wpdb->query("INSERT mailingcdata SET cdata_id=NULL, user_id='$user_id', cfield_id='1', value='$company'");

    }
    add_action( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 3);

    This mostly works, except the for the email address. $firstname, $lastname and $user_id are all correctly added to the table, but the email_address field stays empty.

    Can anyone spot the problem?

    How can I “call” the user’s email address upon ‘wpmu_activate_user’?

    Adding a $user_email argument only produces missing argument errors. I’m out of guesses…

    $current_user->user_email doesn’t work either:

    $wpdb->query("INSERT mailingusers SET users_id='$user_id', group_id='1', signup_date= UNIX_TIMESTAMP(), firstname= '$firstname', lastname= '$lastname', email_address= '$current_user->user_email'");

    #51172
    gerikg
    Participant

    Sorry about the empty response. I thought I had it and when it didn’t work it screwed up. I edited out my post.

    Okay this is the fix I came out with. I created a new group in BP profile called signature and the field name signature too.

    In BBpress in the post.php I inserted (note I don’t know PHP, if anyone can shorten this would be appreciated):

    <?php if ( bp_has_profile('user_id='.get_post_author_id().'&profile_group_id=XXX') ) : ?>
    <?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
    <?php if ( bp_profile_group_has_fields() ) : ?>
    <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
    <?php if ( bp_field_has_data() ) : ?>
    <?php bp_the_profile_field_value() ?>
    <?php endif; ?>
    <?php endwhile; ?>
    <?php endif; ?>
    <?php endwhile; ?>
    <?php else: ?>
    <?php endif;?>

    Just replace XXX with your group id #, mine was 3.

    What it doesn’t do is toggle between signature, anyone want to try that?

    peterverkooijen
    Participant

    Stuck again…

    I think this is the function that takes the input from the registration form (in bp_xprofile_classes.php):

    function get_signup_fields() {
    global $wpdb, $bp;

    $sql = $wpdb->prepare( "SELECT f.id FROM {$bp->profile->table_name_fields} AS f, {$bp->profile->table_name_groups} AS g WHERE g.name = %s AND f.parent_id = 0 AND g.id = f.group_id ORDER BY f.id", get_site_option('bp-xprofile-base-group-name') );

    if ( !$temp_fields = $wpdb->get_results($sql) )
    return false;

    for ( $i = 0; $i < count($temp_fields); $i++ ) {
    $fields[] = new BP_XProfile_Field( $temp_fields[$i]->id, null, false );
    }

    return $fields;
    }

    Then bp-xprofile-signup.php has the function xprofile_load_signup_meta() with this bit:

    $fields = BP_XProfile_Field::get_signup_fields();

    if ( $fields ) {
    foreach ( $fields as $field ) {

    $value = $_POST['field_' . $field->id];

    Followed by lots of validation code. For my purposes I could end it here:

    $fullname = $_POST['field_1'];

    Trying to put it together:

    function synchro_wp_usermeta() {
    global $bp_user_signup_meta, $bp, $wpdb;

    $fields = BP_XProfile_Field::get_signup_fields();

    if ( $fields ) {
    foreach ( $fields as $field ) {

    $value = $_POST['field_' . $field->id];

    }
    }

    $fullname = $value['field_1'];
    $space = strpos( $fullname, ' ' );

    if ( false === $space ) {
    $firstname = $fullname;
    $lastname = '';
    } else {
    $firstname = substr( $fullname, 0, $space );
    $lastname = trim( substr( $fullname, $space, strlen($fullname) ) );
    }

    update_usermeta( $bp->loggedin_user->id, 'nickname', $fullname );
    update_usermeta( $bp->loggedin_user->id, 'first_name', $firstname );
    update_usermeta( $bp->loggedin_user->id, 'last_name', $lastname );

    $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $bp->loggedin_user->id ) );
    $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_url = %s WHERE ID = %d", bp_core_get_user_domain( $bp->loggedin_user->id ), $bp->loggedin_user->id ) );
    }
    add_action( 'user_register', 'synchro_wp_usermeta' );

    Does this make sense? Can any of the more experienced php-coders please point out the obvious mistakes?

    peterverkooijen
    Participant

    Another attempt! What I really need is a variation of the xprofile_sync_wp_profile function that takes $fullname directly from the registration form and can be executed on user_register.

    That shouldn’t be too hard, right?

    function synchro_wp_usermeta() {
    global $bp, $wpdb;

    $fullname = GET FROM THE REGISTRATION FORM INPUT
    $space = strpos( $fullname, ' ' );

    if ( false === $space ) {
    $firstname = $fullname;
    $lastname = '';
    } else {
    $firstname = substr( $fullname, 0, $space );
    $lastname = trim( substr( $fullname, $space, strlen($fullname) ) );
    }

    update_usermeta( $bp->loggedin_user->id, 'nickname', $fullname );
    update_usermeta( $bp->loggedin_user->id, 'first_name', $firstname );
    update_usermeta( $bp->loggedin_user->id, 'last_name', $lastname );

    $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $bp->loggedin_user->id ) );
    $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_url = %s WHERE ID = %d", bp_core_get_user_domain( $bp->loggedin_user->id ), $bp->loggedin_user->id ) );
    }
    add_action( 'user_register', 'synchro_wp_usermeta' );

    I have another plugin that also takes data from the registration form. That plugin has this in the code: $input_data. Is that standard wp? There’s nothing about it in the Codex.

    That other plugin has this function, minus irrelevant bits:

    function subscribe($input_data) {

    // $post_data = array();
    foreach ($input_data as $varname => $varvalue) {
    $post_data[$varname] = $varvalue;
    }

    }
    $post_data='action=subscribe&group_ids[]='.$this->lid.'&email_address='.$this->email_id.'&firstname='.$this->name_id;

    So in my case that last line would become something like this?:

    $post_data= 'first_name='.$this->first_name;

    Of course somehow put together in one function. Like this?:

    function synchro_wp_usermeta($input_data) {
    global $bp, $wpdb;

    $post_data = array();
    foreach ($input_data as $varname => $varvalue) {
    $post_data[$varname] = $varvalue;
    }

    $fullname = $post_data[fullname];
    $space = strpos( $fullname, ' ' );

    if ( false === $space ) {
    $firstname = $fullname;
    $lastname = '';
    } else {
    $firstname = substr( $fullname, 0, $space );
    $lastname = trim( substr( $fullname, $space, strlen($fullname) ) );
    }

    update_usermeta( $bp->loggedin_user->id, 'nickname', $fullname );
    update_usermeta( $bp->loggedin_user->id, 'first_name', $firstname );
    update_usermeta( $bp->loggedin_user->id, 'last_name', $lastname );

    $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $bp->loggedin_user->id ) );
    $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_url = %s WHERE ID = %d", bp_core_get_user_domain( $bp->loggedin_user->id ), $bp->loggedin_user->id ) );
    }
    add_action( 'user_register', 'synchro_wp_usermeta' );

    Can anyone please help? What should I put here for the “fullname” field?:

    $fullname = $post_data[fullname];

    Or is the entire approach wrong?

    peterverkooijen
    Participant

    The phplist-dual-registration plugin also takes input from registration. It has this function:

    function subscribe($input_data) {
    if (!wpphplist_check_curl()) {
    echo 'CURL library not detected on system. Need to compile php with cURL in order to use this plug-in';
    return(0);
    }
    // $post_data = array();
    foreach ($input_data as $varname => $varvalue) {
    $post_data[$varname] = $varvalue;
    }
    // Ensure email is provided
    $email = $post_data[$this->email_id];
    // $tmp = $_POST['lid'];
    // if ($tmp != '') {$lid = $tmp; } //user may override default list ID
    if ($email == '') {
    echo('You must supply an email address');
    return(0);
    }
    // 3) Login to phplist as admin and save cookie using CURLOPT_COOKIEFILE
    // NOTE: Must log in as admin in order to bypass email confirmation
    $url = $this->domain . "admin/";
    $ch=curl_init();
    if (curl_errno($ch)) {
    print '<h3 style="color:red">Init Error: ' . curl_error($ch) .' Errno: '. curl_errno($ch) . "</h3>";
    return(0);
    }

    $post_data='action=subscribe&group_ids[]='.$this->lid.'&email_address='.$this->email_id.'&firstname='.$this->name_id;

    Is the $post_data line what I need? Something like this?:

    function subscribe($input_data) {

    // $post_data = array();
    foreach ($input_data as $varname => $varvalue) {
    $post_data[$varname] = $varvalue;
    }

    $email = $post_data[$this->email_id];
    $name = $post_data[$this->name_id];
    }

    And then I could use $email and $name in my function to “do stuff” with?

    Or can I use $post_data[$this->email_id] etc. directly? Is that the simple answer to my original question?

    Why is the $post_data commented out?! Don’t I need it?

    Do I need other pieces to make it work? For which fields would this work; only those from wp_users or xprofile as well? What about custom fields, including the real name/first name/last name mess?

    #49572

    In reply to: WP Groups

    chrisknade
    Participant

    Right to clarify abit more this is what I have so far.

    <?php echo the_title(); ?>
    <?php if ( bp_has_groups( 'type=single-group&slug=USA' ) ) : ?>

    <div class="pagination-links" id="group-count">
    <?php bp_group_pagination_count() ?>
    </div>

    <div class="pagination-links" id="group-pag">
    <?php bp_group_pagination() ?>
    </div>

    <ul id="group-list">
    <?php while ( bp_groups() ) : bp_the_group(); ?>
    <li>
    <!-- Example template tags you can use -->
    <?php bp_group_avatar_thumb() ?>
    <?php $group_Id_Featured = bp_group_id() ?>
    <?php bp_group_permalink() ?>
    <?php bp_group_name() ?>
    <?php bp_group_total_members() ?>
    <?php bp_group_description_excerpt() ?>
    </li>
    <?php endwhile; ?>
    </ul>

    <?php else: ?>

    <div id="message" class="info">
    <p>There are no groups to display.</p>
    </div>

    <?php endif; ?>

    <?php if ( bp_group_has_members('group_id=2&per_page=8') ) : ?>

    <div id="member-count" class="pag-count">
    <?php bp_group_member_pagination_count() ?>
    </div>

    <div id="member-pagination" class="pagination-links">
    <?php bp_group_member_pagination() ?>
    </div>

    <ul id="member-list" class="item-list">
    <?php while ( bp_group_members() ) : bp_group_the_member(); ?>

    <li>
    <!-- Example template tags you can use -->

    <?php bp_group_member_avatar() ?>
    <?php bp_group_member_link() ?>
    <?php bp_group_member_joined_since() ?>
    </li>
    <?php endwhile; ?>
    </ul>

    <?php else: ?>

    <div id="message" class="info">
    <p>This group has no members.</p>
    </div>

    <?php endif;?>

    As you can see I’ve got <?php $group_Id_Featured = bp_group_id() ?> in there.

    Im trying to say if

    <?php if ( bp_group_has_members(‘group_id=2&per_page=8’) ) : ?> and use group_id=$group_Id_Featured . Anyone have any idea for the syntax for that. Tried loads of different variations none of which work.

    #49346

    In reply to: New Groupblog Plugin

    Mariusooms
    Participant

    Good idea r-a-y! It is summer vacation now, but I will definitely include some as our users start building their profile and groups with this plugin. These are some upcoming feautures:

    * Construct the group_id, this allows us to switch blogs in the group and pull in the relevant information. (done)

    * Construct the reverse blog_id, this allows us to have group based loops in the blog to display members, profile, activity etc based on the group id. (done)

    * Allow blog registration at group sign up, much like how you can create a blog at site registration.

    * Add members silently to the blog when they become group members.

    * Different role caps depending on role within the group. By default members are authors, mods are editors and admins are admins.

    * Allow the admin set role caps on group roles, e.g. the group admin only want its members to be subscribers. Or editors for a wiki type solution.

    * Have an option to disable silent adding of members in case the group admin only wants (or needs) the group blog be accessible by him (or her).

    * Create more templates. One we have now is a simple template that creates a menu from the page titles, which allows the group to behave like a cms.

    We will also offer some blog templates to help make the blog look transparent to the information you display within the group so its transition from group to blog nad vice versa is seemless.

    Thanks for your interests already.

    #48193
    Treblamah
    Participant

    Thanks. I ended up just switching the Group ID on the field I wanted to separate and called that profile group where I wanted the field to appear. I reproduced the profile loop in the index.php file for the user profile twice, once calling group 1 and the other, group 3.

    <?php if ( bp_has_profile('profile_group_id=3') ) : ?>

    #48133
    landykos
    Participant

    I just did a query on the members table then did a for each on the results. and for each group run the buddypress function:

    global $wpdb;

    $groups = $wpdb->get_results(“SELECT * FROM wp_bp_groups order by name”, ARRAY_A);

    foreach ($groups as $group) :

    bp_group_has_members(‘group_id=’.$group[‘id’].’&exclude_admins_mods=false’)

    Then $group[‘name’] will get you the members name.

    Hope that helps you!

    LK

    #46281
    Burt Adsit
    Participant

    Depends on where you are.

    If you are in the member theme group pages the global $group_obj is available. It’s an instance of BP_Groups_Group class for the current group.

    If you are in a group template then the fn bp_get_group_id() in bp-groups-templatetags.php gets you the current group’s id.

    Or you could always use the class method BP_Groups_Group::get_id_from_slug($slug) in bp-groups-classes.php

    #45193
    Burt Adsit
    Participant

    Well, when I did this for bpgroups I just piggybacked onto the groups component. bpgroups records new topic and post activity that is directly created in bbpress. Since bp group forums was already recording the activities, I just had to simulate the same thing.

    The function bp_activity_record() in bp-activity.php does the grunt work. It takes about a zillion parameters. Here’s how I did it:

    $activity = array(
    'item_id' => (int)$group_id,
    'component_name' => 'groups',
    'component_action' => 'new_forum_post',
    'is_private' => 0,
    'secondary_item_id' => (int)$post['post_id'],
    'user_id' => (int)$post['poster_id'] );

    // create a group obj that the rest of bp can use, play nice
    $group_obj = new BP_Groups_Group($group_id);
    groups_record_activity($activity);

    groups_record_activity() in bp-groups.php takes an array param and if you look in there it eventually calls bp_activity_record()

    You’ll have to figure out how to translate all the params that takes into the table colums and eventually into what you see displayed. There aren’t any docs for the activity streams as far as I know.

    #43276
    isuru
    Participant

    sry, this is the source code. i have mentioned the functions which i modified only.

    the screen “create new group” appears with added field, the error is given when saving.

    what are the other files to be modified????????

    <?php

    /**********************

    bp-group.php

    **********************/

    function groups_install() {

    /*some code goes here*/

    $sql[] = “CREATE TABLE {$bp->groups->table_name} (

    …………..

    author varchar(50) NOY NULL,

    ………….

    ) {$charset_collate};”;

    /*some code goes here*/

    }

    function groups_check_installed() {

    if(is_site_admin()){

    if ( !$wpdb->get_var(“SHOW TABLES LIKE ‘%” . $bp->groups->table_name . “%'”) || ( get_site_option(‘bp-groups-db-version’) < BP_GROUPS_DB_VERSION ) )

    groups_install();

    }

    /*some code goes here*/

    }

    function groups_screen_group_admin_edit_details() {

    /*some code goes here*/

    if ( $bp->current_component == $bp->groups->slug && ‘edit-details’ == $bp->action_variables[0] ) {

    if ( $bp->is_item_admin || $bp->is_item_mod ) {

    if ( isset( $_POST[‘save’] ) ) {

    if ( !groups_edit_base_group_details( $_POST[‘group-id’], $_POST[‘group-name’], $_POST[‘group-desc’], $_POST[‘group-news’], $_POST[‘author’], (int)$_POST[‘group-notify-members’] ) ) {

    bp_core_add_message( __( ‘There was an error updating group details, please try again.’, ‘buddypress’ ), ‘error’ );

    } else {

    /*some code goes here*/

    }

    /*some code goes here*/

    }

    do_action( ‘groups_screen_group_admin_edit_details’, $group_obj->id );

    bp_core_load_template( ‘groups/admin/edit-details’ );

    }

    }

    }

    add_action( ‘wp’, ‘groups_screen_group_admin_edit_details’, 4 );

    function groups_create_group( $step, $group_id ) {

    /*some code goes here*/

    if ( is_numeric( $step ) && ( 1 == (int)$step || 2 == (int)$step || 3 == (int)$step || 4 == (int)$step ) ) {

    if ( !$group_obj )

    $group_obj = new BP_Groups_Group( $group_id );

    switch ( $step ) {

    case ‘1’:

    if ( !check_admin_referer( ‘groups_step1_save’ ) )

    return false;

    if ( $_POST[‘group-name’] != ” && $_POST[‘group-desc’] != ” ) {

    /*some code goes here*/

    $group_obj->author = stripslashes($_POST[‘author’]);

    /*some code goes here*/

    if ( !$group_obj->save() )

    return false;

    /*some code goes here*/

    }

    break;

    /*some code goes here*/

    }

    }

    function groups_screen_create_group() {

    /*some code goes here*/

    if ( isset( $_POST[‘save’] ) || isset( $_POST[‘skip’] ) ) {

    /*some code goes here*/

    if ( !$group_id = groups_create_group( $create_group_step, $_SESSION[‘group_obj_id’] ) ) {

    /* error message*/

    } else {

    /*some code goes here*/

    }

    /*some code goes here*/

    }

    /*some code goes here*/

    bp_core_load_template( ‘groups/create’ );

    }

    function groups_edit_base_group_details( $group_id, $group_name, $group_desc, $group_news, $group_author, $notify_members ) {

    /*some code goes here*/

    if ( !check_admin_referer( ‘groups_edit_group_details’ ) )

    return false;

    if ( empty( $group_name ) || empty( $group_desc ) )

    return false;

    /*some code goes here*/

    $group->news = $group_news;

    /*some code goes here*/

    if ( !$group->save() )

    return false;

    if ( $notify_members )

    groups_notification_group_updated( $group->id );

    /*some code goes here*/

    }

    function groups_screen_group_admin_edit_details() {

    /*some code goes here*/

    if ( $bp->current_component == $bp->groups->slug && ‘edit-details’ == $bp->action_variables[0] ) {

    if ( $bp->is_item_admin || $bp->is_item_mod ) {

    if ( isset( $_POST[‘save’] ) ) {

    if ( !groups_edit_base_group_details( $_POST[‘group-id’], $_POST[‘group-name’], $_POST[‘group-desc’], $_POST[‘group-news’], $_POST[‘author’], (int)$_POST[‘group-notify-members’] ) ) {

    /*error message*/

    } else {

    /*some code goes here*/

    }

    /*some code goes here*/

    }

    /*some code goes here*/

    }

    }

    }

    //add_action();

    /**********************

    bp-groups-classes.php

    **********************/

    class BP_Groups_Group {

    /*some code goes here*/

    var $news;

    function populate( $get_user_dataset ) {

    /*some code goes here*/

    if ( $group ) {

    /*some code goes here*/

    $this->author = stripslashes($group->author);

    /*some code goes here*/

    }

    }

    function save() {

    /*some code goes here*/

    if ( $this->id ) {

    $sql = $wpdb->prepare(

    “UPDATE {$bp->groups->table_name} SET

    author = %s,

    WHERE

    id = %d

    “,

    /*some code goes here*/

    $this->author,

    /*some code goes here*/

    );

    } else {

    $sql = $wpdb->prepare(

    “INSERT INTO {$bp->groups->table_name} (

    news,

    ) VALUES (

    %s

    )”,

    /*some code goes here*/

    $this->author,

    /*some code goes here*/

    );

    }

    /*some code goes here*/

    }

    }

    /**********************

    bp-groups-filters.php

    **********************/

    add_filter( ‘bp_group_author’, ‘wptexturize’ );

    add_filter( ‘bp_group_author’, ‘convert_smilies’ );

    add_filter( ‘bp_group_author’, ‘convert_chars’ );

    add_filter( ‘bp_group_author’, ‘wpautop’ );

    add_filter( ‘bp_group_author’, ‘make_clickable’ );

    /**********************

    bp-groups-templatetags.php

    **********************/

    /*some code goes here*/

    function bp_group_author() {

    global $groups_template;

    echo apply_filters( ‘bp_group_author’, stripslashes($groups_template->group->author) );

    }

    function bp_group_author_editable() {

    global $groups_template;

    echo apply_filters( ‘bp_group_author_editable’, $groups_template->group->author );

    }

    /*some code goes here*/

    function bp_group_create_form() {

    /*some code goes here*/

    ?>

    <form action=”<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/create/step/<?php echo $create_group_step ?>” method=”post” id=”create-group-form” class=”standard-form” enctype=”multipart/form-data”>

    <?php switch( $create_group_step ) {

    case ‘1’: ?>

    <label for=”author”>* <?php _e(‘Author’, ‘buddypress’) ?></label>

    <textarea name=”author” id=”author”><?php echo ( $group_obj ) ? $group_obj->author : $_POST[‘author’]; ?>

    </textarea>

    <?php do_action( ‘groups_custom_group_fields_editable’ ) ?>

    <p><input type=”submit” value=”<?php _e(‘Create Group and Continue’, ‘buddypress’) ?> »” id=”save” name=”save”/></p>

    <?php wp_nonce_field( ‘groups_step1_save’ ) ?>

    <?php break;

    /*some code goes here*/

    }

    }

    ?>

Viewing 25 results - 526 through 550 (of 564 total)
Skip to toolbar