Feature Request: Change Post Author
-
This seems like a trivial request, but it would make “importing” small or newer forums to the bbPress 2.0 plugin much easier. If it would be possible to create a topic and replies and change the authors (admin privileges only), I would greatly appreciate it!
-
That would be very useful, indeed!
I believe you can add the ‘author’ capability to the custom post-type ‘topics’ and ‘replies’, hence giving you the needed input box to change the author on the admin side.
Well I gave it a shot using the following code, but for some reason the only user that shows up is my admin account. I’m guessing this has nothing to do with bbpress, but more wp. I think I am missing something somewhere, and will try to find a solution sometime.
*code I was using to add author box to topics
add_action( 'init', 'my_add_author_to_topics' );
function my_add_author_to_topics() {
add_post_type_support( 'topic', 'author' );
}Did anyone get this working.
I think this is hugely useful for transfering…by hand.
Im vurrently wanting to transfer from simple press and there is no importer, so either have to do it by hand or pay someone to do it for me……I like options.
Be cool if someone has this working
OK as an update the above code does actually work but I think it is only pulling in the names of admins…it probably pulls in authors too but it doesnt pull in subscribers.
Im thinking to get it to do this you could use a role management plugin.
OK so after much searching I have a pretty simple solution. The role manager plugin idea was a no go so had to dig deeper.
So add this in your functions.php:
//add author change functionality to bbPress topics in wp-admin
add_action( 'init', 'my_add_author_to_topics' );
function my_add_author_to_topics() {
add_post_type_support( 'topic', 'author' );
}
//then allow subscribers to be authors...good for transfering to bbPress forum which uses custom post types
add_filter('wp_dropdown_users', 'MySwitchUser');
function MySwitchUser($output)
{
//global $post is available here, hence you can check for the post type here
$users = get_users();
$output = "<select id="post_author_override" name="post_author_override" class="">";
//Leave the admin in the list
$output .= "<option value="1">Admin</option>";
foreach($users as $user)
{
$sel = ($post->post_author == $user->ID)?"selected='selected'":'';
$output .= '<option value="'.$user->ID.'"'.$sel.'>'.$user->user_login.'</option>';
}
$output .= "</select>";
return $output;
}So this basically allows you to set any user as a post author whether they are a subscriber or not (by default WP only lets you set author roles or above as post authors).
I think I will just use is temporarily during transfer and then comment it out….I would image it could get annoying if you have loads of subscribers and are just trying to find authors etc.
I guess this code could be made into a plugin with an on/off switch in the admin for it….any takers?
Anyway I hope this helps folk in the same boat as me.
Thanks a bunch!
You know the issue is mostly concerning specific roles. WP has the author drop down for Editors, Admin and such. It seems that same functionality could be applied to BP in the back-end editor.
J. Christopher
I added this feature to topics as well as replies. But selected state is not happening for me. No option has selected state. Anyone else has had this?
So add this in your functions.php:
Which one exactly? I tried both WP’s, bbPress’s and theme’s: all of them lead to error 500. I have all most recent versions of WP and bbPress.
Add this to theme’s functions.php. Worked for me. Added this for topics and replies. Check that you wouldn’t have a syntax error.
Sorry, what syntax error? I just added that to the end of the theme’s functions.php.
Well I’m just thinking that you may have had an error in the code since you got 500. That’s all.
Well I’m just thinking that you may have had an error in the code since you got 500. That’s all.
Um, I’m just not that experienced 🙂
Should the code be appended to the end? Does its position matter at all?
I tried to use the bit of code postet here above by Anointed.
I put it in the functions.php file of my buddypress theme.
It didn’t have any effect…On the other hand, I found a plugin that does the job, but just partially:
https://wordpress.org/extend/plugins/orbisius-bbpress-enhancer/
(Orbisius bbPress enhancer)This plugin works fine, but it allows me to change only the COMMENTS authors, not also the REPLIES authors.
(forums in bbPress consist hierarchically in: FORUM > TOPIC > COMMENT > REPLY)
I Would be grateful if any coding specialist among you would tell me what to do with the codes above, to get them working (for comments AND replies).
I found at last what I was looking for:
https://github.com/turtlepod/gt-bbpress-author
here is a “GT | bbPress Author Drop Down” that works like a charm!
It works for me in BuddyPress, with bbpress forums, WP 3.5.1I could not find the plugin in the repository, just in github.
For non-specialists:
You have to copy the file content (that you see on the github page) in a new file, save it as a php, put it in a zip file on your desktop, and then install the plugin by using the “uload a zip” feature in your wordpress installation.Hi,
I am the author of Orbisius bbPress Enhancer plugin. The plugin does support changing the author of the bbPress reply.
Sometimes WordPress just hides it. To show the author dropdown menu you need to go to click on Screen Options near help (top right corner under the admin nav bar). Then you’ll need to check box near Author.
This is exactly what I need but I’m getting a fatal error when I try to activate the plugin:
Parse error: syntax error, unexpected T_STRING in /xyz-mysite/wp-content/plugins/changeauthors.php_/changeauthors.php on line 36
I copied the code exactly off github, turned it to a php file, zipped it and then uploaded as a plugin.
@jonblazn I would suggest your open an issue on the authors GitHub repo
https://github.com/turtlepod/gt-bbpress-author/issues
- You must be logged in to reply to this topic.