Forum Replies Created
-
take a look at those plugins:
http://bp-dev.org/plugins/registered-users-only-2/
http://bp-dev.org/plugins/bbpress-force-login/
http://bp-dev.org/plugins/force-member-login/
you may find what you want…
Thanks from me too! And yes, i should read more about that stuff! i took a brief look at your code and i am little bit relieved not to be totally wrong. on the other hand not right, so i will take a closer look soon. i think after my upcoming exams i will get deeper into the wp and bp coding, but first things first. working with code is for now only a hobby. thanks again!
@nicola: Thanks a bunch for looking at the code!!! And anyways for your work at bp-dev.org!!!
___
below is the code, it doesn’t work. th error message is:
Warning: Invalid argument supplied for foreach() in ../mu-plugins/ng-who_is_online_2_friends_ver0001.php on line 17
i am getting the feeling the project is way over my head. because i have really no experience in coding my self or on my own. until now i only worked with the given code of word- and buddypress, without diving deeply into php-programing.
therefor i am not even sure if it’s the right way to begin. my thought process was that the friends widget i have is identifying friends by their id’s. so the thing to do is comparing these id’s to those of the users online.
maybe that thought apart is over simplified. otherwise it could just as well be the case that my understanding for php isn’t enough.
possibly the best idea would be to buy a book about php. learn more about it and then begin to build widgets. otherwise it might be not that complicated, if you have the skills.
<?php
function bp_friend_o_avatar_thumb_mini( $template = false ) {
global $bp, $current_blog;
$options = get_blog_option( $current_blog->blog_id, 'bp_friend_o_avatar_thumb_mini' );
$friend_ids = BP_Friends_Friendship::get_random_friends( $bp->displayed_user->id );
$users = BP_Core_User::get_online_users($options['max_members']);
?>
<?php if ( $friend_ids ) { ?>
<?php for ( $i = 0; $i < count( $friend_ids ); $i++ ) { ?>
<?php foreach ( $friend_ids[$i] == $users->user_id as $friend_ids ) : ?>
<a>"><?php echo bp_core_get_avatar( $friend_ids[$i], 1,/** here you can change the thumbnailsize **/ 32, 32 ) ?></a>
<?php endforeach; ?>
<?php } ?>
<?php } else { ?>
<?php } ?>
<div class="clear"></div>
<?php
}
function ng_fs_o_usersidebar() {
echo '<link rel="stylesheet" type="text/css" href="' . get_settings('siteurl') . '/wp-content/mu-plugins/ng-fs-sb/fs.css" />';
?>
<div id="widget">
<ul id="friend-list_sb" class="item-avatar">
<li>
<?php bp_friend_o_avatar_thumb_mini() ?>
</li>
</div>
<?php }
function Widget_ng_fs_o_usersidebar($args) {
global $bp;
extract($args);
echo $before_widget;
echo $before_title;?>
<?php bp_word_or_name( __( "Friends", 'buddypress' ), __( "Friends", 'buddypress' )/*__( "%s's Friends", 'buddypress' )*/ ) ?> (<?php echo BP_Friends_Friendship::total_friend_count( $bp->displayed_user->id ) ?>) <a>displayed_user->domain . $bp->friends->slug ?>"><?php _e('All', 'buddypress') ?> »</a>
<?php echo $after_title;
ng_fs_o_usersidebar();
echo $after_widget;
}
function init_Sidebar_BP_ng_fs_o_sb()
{
register_sidebar_widget(__('ng_fs_sb'), 'Widget_ng_fs_o_usersidebar');
}
add_action("plugins_loaded", "init_Sidebar_BP_ng_fs_o_sb");
?>thanks! now i know i don’t need to work with sql. i thought and tried it with the bp classes like you say, but i had no success. now i will try again! hopefully soon i post an upadte.
hi!
here are some referenzes:
http://bp-dev.org/phpxref/nav.html?index.html
https://codex.buddypress.org/developer-docs/creating-a-custom-buddypress-component/
https://codex.buddypress.org/developer-docs/create-a-buddypress-member-theme/
if i understand you corectly your aim is make a simplified buddypress-home theme or a replacement for the standard home theme. right!? you may be want to take a look here: http://kommune.ngcorp.de – it is my own simplified home theme. i took the orginal home theme and striped it down. only for an example what is possible
hi!
maybe i understood this wrong. fishbowl81 described a possibilty for a “Friends Online” function/widget, right?
o.k. if thats right, i am happy because that is what i am searching. the problem now seems to be, that my knowledge isn’t enough to realize it. i need some help!
taking the function like posted here leads to an error. like fishbowl mentioned $bp changes, therefor i changed: ” . $bp . ” first to: ” . $bp->friends->table_name . ” second to: {$bp->friends->table_name}. in both cases no error, but it doesn’t seem to work the i way i want, showing recently active friends, instead it shows the friend not active for weeks.
o.k., i don’t have a clue how sql works. so i can not figure out what’s wrong. maybe it’s something very simple… if someone would take a look at this problem i would be very thankful!
Thanks ndrwld! Solved the FF3 Problem. Works perfect for me!
in general you have to locate the widget code. then copy it into a new file. IMPORTANT you have to rename the functions. do not forget to register and load the new widget. after that you should be able to use your “own, new” widget.
o.k. it is not always that easy, but sometimes.
hi,
take a look here: http://kommune.ngcorp.de/blog
and download it here: http://blog.ngcorp.de/downloads/bp-downloads/
for a 2nd who is online widget
@webmatter: take a look here: http://bp-dev.org/phpxref/nav.html?index.html
hi,
most likely you have to customize yourself. i dont know a address for premium themes, in my opinion there is non. but you might look here: freebuddypressthemes.com, where daniel felice is trying to build up a place for sharing buddypressthemes.
nicolai
don’t mind my last question. i just read you will release the widgets soon.
absolutely! i would appreciate that. go on and take them!
another question, would you mind taking a look at this topic: https://buddypress.org/forums/topic.php?id=1417 . i stuck on that, after fixing the described problem i want publish the widget to.
thanks in advance!
Take a look at:.