Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

  • yusufhm
    Participant

    @yusufhm

    Good catch Prashant, although mine was not working even though I was calling that function.


    yusufhm
    Participant

    @yusufhm

    Looks like we both followed the same article: https://codex.buddypress.org/plugindev/how-to-edit-group-meta-tutorial/

    I was able to resolve the issue you were having by modifying the custom_field function a bit, so it becomes like this:

    
    function custom_field($meta_key='') {
            $value = groups_get_groupmeta( bp_get_group_id(), $meta_key);
            if ($value) {
                return $value;
            }
    
            $bp   = buddypress();
            if ($bp->groups->current_group) {
                $group_id = $bp->groups->current_group->id;
                return groups_get_groupmeta($group_id, $meta_key, TRUE);
            }
            return FALSE;
    }
    

    It looks like the meta value’s already saved after the first step, and your group already has an ID; so it’s just a question of retrieving that. bp_get_group_id() somehow does not do the job for I don’t know what reason (maybe the group is not yet visible, or the cache has not been updated yet).

Viewing 2 replies - 1 through 2 (of 2 total)
Skip to toolbar