Search Results for 'code'
-
Search Results
-
I found the excellent article by Tanner Moushey on how to create groups programmaticaly: https://tannermoushey.com/2014/08/create-groups-buddypress/
However I also need to create a forum for each group, and I can’t get his suggestion of using groups_new_group_forum to work. I read other posts of getting function doesnt exist error for bp_forums_new_forum (which groups_new_group_forum calls), but I believe I found the right requires to get that function, and everything it depends on, but now I am getting an error about null several layers down within bb code.
Here is my code so far:
<?php
/* Show the errors in browser */error_reporting(E_ALL);
ini_set('display_errors', 1);/** Load WordPress Bootstrap */
require_once( dirname( __FILE__ ) . '/../admin.php' );/** Load WordPress dashboard API */
require_once(ABSPATH . 'wp-admin/includes/dashboard.php');wp_dashboard_setup();
do_action('bbpress_init');
?>
<H1>Add Groups</H1>
<?php
$args = array(
'group_id' => 0,
'creator_id' => 0,
'name' => 'California',
'description' => 'For people located in California',
'slug' => 'california',
'status' => 'public',
'enable_forum' => 1,
'date_created' => bp_core_current_time()
);?>
<p>Creating group '<?php echo $args[name] ?>'</p>
<?php
$newgroupid = groups_create_group($args);
?>
<?php
////////////////////////////
// Now creating a new forum// Not needed for get groups_create_group - this already got included
// require_once(ABSPATH . 'wp-content/plugins/buddypress/bp-groups/bp-groups-forums.php');// For bp_forums_new_forum
require_once(ABSPATH . 'wp-content/plugins/buddypress/bp-forums/bp-forums-functions.php');// For bb_new_forum
require_once(ABSPATH . 'wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/class.bb-walker.php');
require_once(ABSPATH . 'wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php');// For bb_current_user_can
require_once(ABSPATH . 'wp-content/plugins/buddypress/bp-forums/bbpress/bb-includes/functions.bb-capabilities.php');// Example from: http://buddypress.wp-a2z.org/oik_api/groups_new_group_forum/
$newforumid = groups_new_group_forum($newgroupid,'California','For people located in California');?>
<table>
<tr><td>Newly created group id:</td><td><?php echo $newgroupid ?></td><td>Groups</td>
</tr>
<tr><td>Newly created forum id:</td><td><?php echo $newforumid ?></td><td>Forums</td>
</tr></table>
It throws this error:
Fatal error: Uncaught Error: Call to a member function get_var() on null in /Users/eyespider/projects/justiceserved/local/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php:992 Stack trace:
#0 /Users/eyespider/projects/justiceserved/local/wp-content/plugins/buddypress/bp-forums/bp-forums-functions.php(123): bb_new_forum(Array)
#1 /Users/eyespider/projects/justiceserved/local/wp-content/plugins/buddypress/bp-groups/bp-groups-forums.php(47): bp_forums_new_forum(Array)
#2 /Users/eyespider/projects/justiceserved/local/wp-admin/custom/add-groups2.php(67): groups_new_group_forum(38, 'California', 'For people loca...')
#3 {main} thrown in /Users/eyespider/projects/justiceserved/local/wp-content/plugins/buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php on line 992Hi, I added a new wordpress role and would like it to map new users not to the participant role but rather to spectator.
So I added this filter in my functions.php.
add_filter('bbp_get_user_role_map', 'assign_spectator_role'); function assign_spectator_role($roles) { $roles['mynewrole'] = bbp_get_spectator_role(); return (array) $roles; }Problem is that this filter does not get executed.
If I add my role directly in thebbp_get_user_role_map functionit works but not with the filter.
The tools function ‘remap_roles’ also works fine.Any ideas how I can get it to work?
Cheers.
Hi, I’m using bbpress on my upcoming videogame website:
http://20160719.gaming-universe.de/guf/topic/testtest/#post-6864As you can see, the template uses information from the WP theme style.css.
This is overall a good thing but the blockquote function looks off.
I’m also using a couple of plugins so I feel that I might be able to change that via a CSS function but don’t understand CSS very well.When looking at the code, the blockquote seems to use a specific class from one of my plugins:
blockquote class=”d4pbbc-quote”Can anyone point me to where I can change the CSS for the blockquote attribute?
Thanks, Matthias
Topic: Forum Index Customization
I hope this is the right place for this. Sorry if it isn’t.
The long and short of my issue is that everything is too compact on my forum index. I’ve made a page, with the forum index shortcode, and when it shows, a lot of it is packed together in a way I don’t particularly care for. Here’s a screen shot:

See how all the sub-forums of the category is the title and basic stats? And how the Category shows it’s description? I’d like to have the sub-forums’ descriptions showing here, too. Is that possible? What would I need to change? Is there some plugin or check box I need to hit?
Thanks in advance!
Topic: Errors creating forum
I am just getting set up with BBpress and am in the process of creating the forums.
So I am running into problems.
The first error I get is

I click on OK to clear the error then click publish again then I get this error on a white screen:
Fatal error: Cannot use object of type WP_Post as array in /srv/disk11/2110213/www/jimandms.com/wp-content/plugins/social-networks-auto-poster-facebook-twitter-g/inc/nxs_functions_adv.php on line 155I can go pull up the forum list and the forum that I just created is there. But I would still much rather not see any errors at all, of course.
My website is http://jimandms.com if you would like to pay a visit for some reason.
Thanks for reading!
Jim