Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'group_id'

Viewing 25 results - 501 through 525 (of 567 total)
  • Author
    Search Results
  • #71625
    Brajesh Singh
    Participant

    Simply, create a child theme, copy the members/single/profile/ edit.php to

    yourchild-theme/members/single/profile/edit.php

    Now modify it slightly,

    Like put his before the first line of edit.php

    <?php if(bp_get_current_profile_group_id()==1):?>
    <ul class="button-nav">
    <?php bp_profile_group_tabs(); ?>
    </ul>
    <div class="clear"></div>
    <?php
    locate_template(array("members/single/profile/profile-loop.php"),true);?>
    <p><b>Your Username is your identity and We hate to see you changing your identity, so our computer has decided to disable editing it for you.Please Edit all other data in your profile as you wish :)
    </b>
    </p>
    <?php
    else:?>

    and at the end of Edit.php put this line

    <?php endif;?>

    Now go and check your profile page.

    please let me know if it works or not

    #71592
    jivany
    Participant

    @gian-ava: For your second question, check out this post https://buddypress.org/forums/topic/faq-how-to-code-snippets-and-solutions#post-13243

    I haven’t tried this but it would suggest you could do something like:

    <?php if ( bp_has_profile('profile_group_id=9') || bp_has_profile('profile_group_id=7') ) : ?>
    <?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
    <div id="widget1">
    <?php if (bp_the_profile_group() == "9") : ?>
    // Do whatever you want with group 9
    <?php endif; ?>
    <?php if (bp_the_profile_group() == "7") : ?>
    // Do whatever you want with group 7
    <?php endif; ?>
    </div>
    <? endwhile; ?>
    <?php endif; ?>

    The only part I’m not sure about is if you need the first call to bp_the_profile_group() on the second line (after the start of the while loop).

    #71411
    Gianfranco
    Participant

    And another thing I am trying know (Question #2) is if it is possible to use a conditional statement to check if more than 1 group has fileds that has been filled in and return something accordingly:

    <?php if ( bp_has_profile('profile_group_id=9') || bp_has_profile('profile_group_id=7') ) : ?>
    <?php while ( bp_profile_groups() ) : bp_the_profile_group(); if ( bp_profile_group_has_fields() ): //groups loop ?>

    <div id="widget1">

    (stuff from group 9)

    (stuff from group 7)

    </div>

    <?php endif; endwhile; ?>
    <?php endif; ?>

    After experimenting, I couldn’t make it work.

    I need that because in my design I’d like to output a “Personal stuff” widget that has a graphic title and background, and it should display only if some fields from groups 9 and 7 are filles in, otherwise it should’t.

    Is that achievable?

    That is a guru question, isn’t it?

    #71064
    rich! @ etiviti
    Participant

    First, I just found a small bug and fixed it in the trunk – you just need to update the file: bp-forum-extras-activity.php

    Second, make sure you add the theme edit (detailed on forum extras wp-admin page)

    The comments appear directly underneath the post which has the activity. It pulls in all replies for the given post (so threaded). It will work for any backdated activity comments – whatever it can find for the given group_id and post_id (item_id)

    http://files.etiviti.com/misc/buddypress/bp-group-forum-topic-post-activity-1.gif

    http://files.etiviti.com/misc/buddypress/bp-group-forum-topic-post-activity-2.gif

    http://files.etiviti.com/misc/buddypress/bp-group-forum-topic-post-activity-3.gif

    http://files.etiviti.com/misc/buddypress/bp-group-forum-topic-post-activity-4.gif

    #70339
    Andy Peatling
    Keymaster

    $activity_id = bp_activity_post_update( array( ‘content’ => $content, ‘user_id’ => $user_id ) );

    $activity_id = groups_post_update( array( ‘content’ => $content, ‘user_id’ => $user_id, ‘group_id’ => $group_id ) );

    The functions above will post an update by the user on their profile, or in a group. It will return the activity ID which you can use to attach a comment:

    $comment_id = bp_activity_new_comment( array( ‘activity_id’ => $activity_id, ‘content’ => $content, ‘user_id’ => $user_id, ‘parent_id’ => [optional] ) );

    You could post a reply to that comment by using the same function and passing the $comment_id as the parent_id param.

    #69371

    In reply to: bbpress and buddypress

    r-a-y
    Keymaster

    You could create one group that all people join when they register.

    Use DJPaul’s Welcome Pack plugin for that:

    https://wordpress.org/extend/plugins/welcome-pack/

    Otherwise go the external bbPress route, and yes, you’ll need to theme it.

    [EDIT]

    Forgot that Paul changed his plugin so it sends out group invites, instead of auto joining groups.

    If you want to make Paul’s plugin automatically join groups.

    Change the following lines in the Welcome Pack plugin from:

    groups_invite_user( array( 'user_id' => $new_user_id, 'group_id' => $group_id, 'inviter_id' => $group->creator_id ) );
    groups_send_invites( $group->creator_id, $group_id );

    to:

    groups_join_group( $group_id, $new_user_id );

    I should say I haven’t tried this, but it should work.

    #68827
    Anointed
    Participant

    going through cleaning up my server logs and noticed the following:

    Notice: Undefined offset: 0 in /wp-content/plugins/bp-groupblog/bp-groupblog.php on line 355
    Notice: Undefined index: default-administrator in /wp-content/plugins/bp-groupblog/bp-groupblog.php on line 361
    Notice: Undefined index: default-moderator in /wp-content/plugins/bp-groupblog/bp-groupblog.php on line 362
    Notice: Undefined index: default-member in /wp-content/plugins/bp-groupblog/bp-groupblog.php on line 363
    Notice: Undefined index: group_id in /wp-content/plugins/bp-groupblog/bp-groupblog.php on line 364
    Notice: Undefined index: groupblog-silent-add in /wp-content/plugins/bp-groupblog/bp-groupblog.php on line 365

    also, very strange problem that just popped up. I did disable every plugin to make sure it was not the issue, but did not help. I tried it on the default bp template, as well as my own.

    http://jerrygaffney.net/groups/mens-ministries/blog/

    notice that there is no title to the article nor is there anything in the ‘page’ icon.

    I think ‘the_title’ is not passing through properly but it does pass through on the blog activity below the blog page.. very very strange, as it used to work, and nothing changed that I know of….

    #68596

    In reply to: @ Group

    rich! @ etiviti
    Participant

    a simple example that will auto link a group slug mention in an activity update

    this a proof == i’m lazy. so it only matches the group slug and NOT the true name (someone would have to build a function for that)

    …and this uses a caret but anything can be used

    function bp_activity_at_groupname_filter( $content ) {

    //define your catch hook, i'm partial to the bang but lets eat a caret
    $pattern = '/[\\^]+([A-Za-z0-9-_]+)/';
    preg_match_all( $pattern, $content, $groupnames );

    /* Make sure there's only one instance of each groupname */
    if ( !$groupnames = array_unique( $groupnames[1] ) )
    return $content;

    foreach( (array)$groupnames as $groupname ) {

    //note this is the group slug as for a proof - need to build a group "name" lookup function
    if ( !$group_id = BP_Groups_Group::group_exists( $groupname ) )
    continue;

    //too much work to get a link
    $thisgroup = new BP_Groups_Group( $group_id );

    $content = str_replace( "^$groupname", "<a href='" . bp_get_group_permalink( $thisgroup ) . "' rel='nofollow'>^$groupname</a>", $content );
    }

    return $content;
    }
    add_filter( 'bp_activity_new_update_content', 'bp_activity_at_groupname_filter' );
    add_filter( 'groups_activity_new_update_content', 'bp_activity_at_groupname_filter' );
    add_filter( 'pre_comment_content', 'bp_activity_at_groupname_filter' );
    add_filter( 'group_forum_topic_text_before_save', 'bp_activity_at_groupname_filter' );
    add_filter( 'group_forum_post_text_before_save', 'bp_activity_at_groupname_filter' );
    add_filter( 'bp_activity_comment_content', 'bp_activity_at_groupname_filter' );

    #68544
    Nick Watson
    Participant
    function bp_featured_group_form() {
    if ( is_site_admin ) {
    ?>
    <hr />
    <div class="radio">
    <label><input type="radio" name="bp_featured_group" value="normal" <?php bp_featured_group_setting('normal') ?> /> <?php _e( 'This is just a normal group', 'featured_group' ) ?></label>
    <label><input type="radio" name="bp_featured_group" value="Featured" <?php bp_featured_group_setting('Featured') ?> /> <?php _e( 'This is a featured group', 'featured_group' ) ?></label>
    </div>
    <hr />
    <?php
    }
    }
    add_action ( 'bp_after_group_settings_admin' ,'bp_featured_group_form' );
    add_action ( 'bp_after_group_settings_creation_step' ,'bp_featured_group_form' );

    function bp_featured_group() {
    if (bp_get_featured_group()) {
    echo bp_get_featured_group();
    }
    }

    // Get the official title group setting
    function bp_get_featured_group( $group = false ) {
    global $groups_template;
    if ( !$group )
    $group =& $groups_template->group;
    $featured_group = groups_get_groupmeta( $group->id, 'bp_featured_group' );
    return apply_filters( 'bp_featured_group', $featured_group );
    }

    // echo official title group checked setting for the group admin - default to 'normal' in group creation
    function bp_featured_group_setting( $setting ) {
    if ( $setting == bp_get_featured_group() )
    echo ' checked="checked"';
    if ( !bp_get_featured_group() && $setting == 'normal' )
    echo ' checked="checked"';
    }

    // Save the official_title group setting in the group meta, if normal, delete it
    function bp_save_featured_group( $group_id ) {
    global $bp, $_POST;
    if ( $postval = $_POST['bp_featured_group'] ) {
    if ( $postval == 'Featured' )
    groups_update_groupmeta( $group_id->id, 'bp_featured_group', $postval );
    elseif ( $postval=='normal' )
    groups_delete_groupmeta( $group_id->id, 'bp_featured_group' );
    }
    }
    add_action( 'groups_group_after_save', 'bp_save_featured_group' );

    I may as well post the code,

    Here it is.

    Thanks

    #67609
    Peter Anselmo
    Participant

    Ray,

    Thanks for the replies. I was using the full wp-content/blog.dir/group_id path as that’s what avatars and several other components use. Which brings me to your next question – files outside of group documents. Yes, they’re working, even with a very similar path.

    Check out the avatar for this group (The dog photo):

    http://wpmu.sixtysixinc.com/wpmu2.8.6/groups/my-group/documents/

    It has the exact same url structure as the documents:

    http://wpmu.sixtysixinc.com/wpmu2.8.6/wp-content/blogs.dir/1/files/group-avatars/3/0fde224e7a1e14965943249bc7fa519b-bpthumb.jpg

    Yet, it’s not getting redirected, and it works fine.

    #67195
    Andy Peatling
    Keymaster

    Great plugin Boone! I found one issue though –

    There’s no pagination, so I could only see the first page of groups. You can just add this:

    <div class="tablenav">
    <div class="tablenav-pages">

    <span class="displaying-num" id="group-dir-count">
    <?php bp_groups_pagination_count() ?>
    </span>

    <span class="page-numbers" id="group-dir-pag">
    <?php bp_groups_pagination_links() ?>
    </span>

    </div>
    </div>

    You will need to move the <?php if( bp_has_groups( $args ) ) : ?> above that though and get it outside of the table generation.

    I also thought it would be nice to add a column at the start for the group avatar?

    <td scope="row" style="text-align: center; padding: 5px 10px">
    <a href="admin.php?page=bp-group-management/bp-group-management-bp-functions.php&action=edit&id=<?php bp_group_id() ?>" class="edit"><?php bp_group_avatar( 'width=35&height=35' ); ?></a>
    </td>

    You’d probably want to move the inline CSS out of there.

    rich! @ etiviti
    Participant

    edit the theme file /activity/entry.php and under the activity-meta div – you’ll see the link for comments. you could add the following checks to that section:

    bp_get_activity_object_name() == 'groups'  //the component name
    groups_is_user_member( $bp->loggedin_user->id, bp_get_activity_item_id() ) //if a group then item_id references the group_id

    (i didn’t test this – just what i found)

    #66437
    draganbabic
    Member

    Hi guys,

    thanks for the ideas. So far I got this running:

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

    <?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() ) : ?>

    style="<?php bp_the_profile_field_value() ?>"

    <?php endif; ?>

    <?php endwhile; ?>

    <?php endif; ?>

    <?php endwhile; ?>

    <?php else: ?>

    <?php endif;?>

    And this indeed outputs the desired value, but it is also wrapped in a paragraph and autolinked. Please do note that I have no idea what I am doing here, weather it is valid, good or anything else, this just got the job done, so it’s a starting point.

    I have searched the forum and found this code that is supposed to remove the autolinking:

    <?php

    function remove_links(){

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

    }

    add_action( 'plugins_loaded', 'remove_links' );

    ?>

    However it doesn’t do that once placed in bp-custom.php

    Any pointers?

    #66108
    rich! @ etiviti
    Participant

    i notified Andy of this problem, but here is my fix – needs to hash the post link (but this would leave to problems when removing a feed and the activity not deleting)

    /* Fetch an existing activity_id if one exists. */
    if ( function_exists( 'bp_activity_get_activity_id' ) )
    $id = bp_activity_get_activity_id( array( 'user_id' => false, 'component' => $bp->groups->id, 'type' => 'exb', 'item_id' => $group_id, 'secondary_item_id' => wp_hash( $post['link'] ) ) );

    /* Record or update in activity streams. */
    groups_record_activity( array(
    'id' => $id,
    'user_id' => false,
    'action' => $activity_action,
    'content' => $activity_content,
    'primary_link' => $post['link'],
    'type' => 'exb',
    'item_id' => $group_id,
    'secondary_item_id' => wp_hash( $post['link'] ),
    'recorded_time' => gmdate( "Y-m-d H:i:s", $post_date ),
    'hide_sitewide' => $hide_sitewide
    ) );

    #64299
    neobabs
    Participant

    @peter-anselmo

    is it not cause of this in line 106 in classes.php ? :

    ” $this->user_id,

    $this->group_id,

    time(),

    time(),

    $this->file,

    $this->name,

    $this->description

    #62814
    sweller
    Participant

    I’d like to open this one back up. The project is for a local recycling program and I’m having trouble with a form for members to schedule pickups on the profile/index page. It calls XProfile address fields and tomorrow’s date for the default values, and should insert them into a custom table. The plugin creates a table and pulls the xprofile data fine, but nothing is reaching the database. I’ve tried every possible variation based on the bp-core and Travel-Junkie’s example above, but nothing is working.

    Here’s the plugin:

    <?php
    /*
    Plugin Name: Collection Records
    Plugin URI: -
    Description: Adds a table and page for listing and editing Recylable Collections.
    Version: 1.0
    */

    function collect_install_table() {
    global $wpdb;
    global $bp;

    if ( !empty($wpdb->charset) )
    $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";

    $table_name = $wpdb->prefix . 'collections';
    if($wpdb->get_var("show tables like '$table_name'") != $table_name) {

    $sql = "CREATE TABLE " . $table_name . " (
    id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    sched_date datetime NOT NULL,
    post_date datetime NOT NULL,
    user_id bigint(20) UNSIGNED NOT NULL,
    address_line_1 varchar(150) NOT NULL,
    address_line_2 varchar(150) NOT NULL,
    town varchar(150) NOT NULL,
    state varchar(150) NOT NULL,
    zip_code varchar(150) NOT NULL,
    amount bigint(20) DEFAULT '0' NOT NULL,
    verified tinyint(1) DEFAULT '1' NOT NULL,
    paid tinyint(1) DEFAULT '1' NOT NULL,
    KEY user_id (user_id)
    ) {$charset_collate};";

    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    dbDelta($sql);
    }
    }

    /*Launch database*/
    register_activation_hook(__FILE__,'collect_install_table');

    function bp_collections() {
    global $wpdb;
    global $bp;

    /* bp_is_home() Checks to make sure the current user being viewed equals the logged in user */

    if ( !bp_is_home() && !is_site_admin() )
    return false;

    /* Check for new information*/
    if( isset($_POST['go'] ))
    {
    /* Check the nonce */

    check_admin_referer( 'schedule_collect' );

    if( $_POST['sched_date'] && ! $_POST['address_line_1'] || ! $_POST['sched_date'] && $_POST['address_line_1'] )
    {
    bp_core_add_message( __( 'We need a time and a place!', 'buddypress' ), 'error' );
    $error = true;
    }

    if( ! $error )
    {
    $user_id = $bp->loggedin_user->id;

    if( isset( $_POST['address_line_2'] ) ) {
    $address_line_2 = $_POST['address_line_2'];
    }

    $result = $wpdb->query( $wpdb->prepare("
    INSERT INTO $wpdb->1_collections
    ( sched_date, post_date, user_id, address_line_1, address_line_2, town, state, zip_code )
    VALUES ( %s, %s, %d, %s, %s, %s, %s, %s )",
    $_POST['sched_date'], $_POST['post_date'], $user_id, $_POST['address_line_1'], $address_line_2, $_POST['town'], $_POST['state'], $_POST['zip_code'] ) );

    /* Set the feedback messages */
    if ( $errors )
    bp_core_add_message( __( 'There was a problem calling your pickup, please try again.', 'buddypress' ), 'error' );
    else
    bp_core_add_message( __( 'Thanks for calling a recycling pickup.', 'buddypress' ) );

    }

    bp_core_load_template( apply_filters( 'xprofile_template_display_profile', 'profile/index' ) );
    }
    }
    /* Function to call xprofile Address label */

    function collections_xprofile( $field ) {
    echo bp_collections_get_member_list_xprofile_data( $field );
    }
    function bp_collections_get_member_list_xprofile_data( $field ) {
    global $bp, $site_members_template;
    return xprofile_get_field_data( $field, $site_members_template->member->id );
    }

    ?>

    And the form:

    <?php if ( bp_has_profile( 'profile_group_id=' . bp_get_current_profile_group_id() ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

    <form action="" method="post" id="oncall" class="oncall">

    <label for="address">At</label>
    <input type="text" name="address_line_1" id="address_line_1" value="<?php echo bp_collections_get_member_list_xprofile_data('Address Line 1') ?>" />
    <input type="text" name="address_line_2" id="address_line_2" value="<?php echo bp_collections_get_member_list_xprofile_data('Address Line 2') ?>" />
    <input type="text" name="town" id="town" value="<?php echo bp_collections_get_member_list_xprofile_data('Town') ?>" />
    <input type="hidden" name="state" id="state" value="MS" />
    <input type="" name="zip_code" id="zip_code" value="<?php echo bp_collections_get_member_list_xprofile_data('Zip Code') ?>" />
    <br />
    <label for="date">On</label>
    <input type="text" name="sched_date" id="sched_date" value="<?php $tomorrow = mktime(0,0,0,date("m"),date("d")+1,date("Y")); echo date("Y/m/d", $tomorrow); ?>" />

    <input type="submit" name="go" id="go" value="go"/>
    <input type="hidden" name="post_date" id="post_date" value="<?php $my_t=getdate(date("U")); print("$my_t[weekday], $my_t[month] $my_t[mday], $my_t[year]"); ?> " />

    <?php wp_nonce_field( 'schedule_collect' ) ?>
    </form>
    <?php endwhile; endif; ?>

    It has to be something simple but I’m lost. I’d really appreciate it if someone could take a minute and tell me what’s wrong with the code.

    #62376
    MrMaz
    Participant

    UPDATE:

    The filtering has been consolidated and drastically improved as of revision 2580. Here is an updated example:

    function my_activity_filter( $query_string, $object, $filter, $scope, $page, $search_terms, $extras ) {
    global $bp;

    if ( $object != 'activity' || $scope != 'myclass' || !is_user_logged_in() )
    return $query_string;

    $args = array();
    parse_str( $query_string, $args );
    $args['object'] = $bp->groups->id;
    $args['primary_id'] = function_to_get_group_id_for_logged_in_user();

    return http_build_query( $args );
    }
    add_filter( 'bp_dtheme_ajax_querystring', 'my_activity_filter', 1, 7 );

    As you can see a TON more information about the request is being passed to the filtering, so you can more easily determine what you need to do to handle it properly.

    #62145
    designodyssey
    Participant

    OK, that was way too simple. Thanks. Wouldn’t have found it unless I knew what I was looking for.

    After searching around for this function (and a comment from Burt), I see there are a few others in bp-core.php. Is there any listing of functions that take user_id or group_id and return information? I searched the “Docs” to no avail.

    #62067
    Andy Peatling
    Keymaster

    do_action( 'groups_join_group', $group_id, $user_id );

    #62021
    peterverkooijen
    Participant

    Thanks Devrim. How do I “run” this? Would putting it into bp-custom.php take care of it? I know how to run a SQL query in phpMyAdmin. That’s essentially what this is, right?

    Is there a reason not to try this manually in phpMyAdmin? Is the group_id field connected to/dependant on other fields that are easy to overlook?

    #62017
    Devrim
    Participant

    Hi Peter, I had the same problem, here is the code that will move everything from group_id 1 to group_id 3

    Check the id of the secondary group and change the number 3.

    require_once(‘wp-blog-header.php’);

    $x = $wpdb->get_results(“SELECT * FROM wp_bp_xprofile_fields WHERE group_id=1 and is_required=0”);

    foreach($x as $k=>$v){

    $wpdb->update(‘wp_bp_xprofile_fields’,array(‘group_id’=>3),array(‘id’=>$v->id));

    }

    #61456
    grosbouff
    Participant

    Seems this has something to do with function has_fields() :

    function has_fields() {

    $has_data = false;

    for ( $i = 0; $i < count( $this->group->fields ); $i++ ) {

    $field = &$this->group->fields[$i];

    if ( $field->data->value != null ) {

    $has_data = true;

    }

    }

    if ( $has_data )

    return true;

    return false;

    }

    print_r($field) returns

    teststdClass Object ( [id] => 1 [name] => Name [type] => textbox [group_id] => 1 ) stdClass Object ( [id] => 2 [name] => Name [type] => textbox [group_id] => 1 ) stdClass Object ( [id] => 3 [name] => First Name [type] => textbox [group_id] => 1 ) stdClass Object ( [id] => 4 [name] => Both Names [type] => textbox [group_id] => 1 )

    print_r($field->data) returns FALSE…

    #61444
    vusis
    Participant

    I have a problem:

    how do i pickup the group_id of the forum topic. Thant way i can build the link to the from topic from the home page.

    #60353
    ajdinb
    Participant

    Just an update. I’m using LDAP Authentication Plug-in; Plugin URI: http://wpmuldap.frozenpc.net

    I found that if I add a user first via WPMU admin CP then permissions work OK. However if the user is created on first login attempt the the issue occurs. I’ve reported this at the plugins site but no reply so far.

    http://sourceforge.net/tracker/?func=detail&aid=2909982&group_id=196841&atid=959074

    There seam to be other LDAP plugins (https://wordpress.org/extend/plugins/simple-ldap-login/ and https://wordpress.org/extend/plugins/simple-ldap-authentication/) which I did not try.

    #60124
    kineda
    Participant

    Thanks. That clears things up. The only other problem I’ve encountered is after I deactivate the BuddyPress plugin and re-activate it, I’ll get the follow db errors:

    WordPress database error: [Duplicate key name ‘useritem’]

    ALTER TABLE wp_bp_notifications ADD KEY useritem (user_id, is_new)

    WordPress database error: [Table ‘wp_bp_activity’ already exists]

    RENAME TABLE wp_bp_activity_user_activity_cached TO wp_bp_activity

    WordPress database error: [Duplicate entry ‘1’ for key 1]

    INSERT INTO wp_bp_xprofile_groups VALUES ( 1, ‘Base’, ”, 0 );

    WordPress database error: [Duplicate entry ‘1’ for key 1]

    INSERT INTO wp_bp_xprofile_fields ( id, group_id, parent_id, type, name, is_required, can_delete ) VALUES ( 1, 1, 0, ‘textbox’, ‘Name’, 1, 0 );

Viewing 25 results - 501 through 525 (of 567 total)
Skip to toolbar