Search

bbPress Showcase » bbPress Chat

  1. netjockey
    User has not uploaded an avatar

    new member
    Joined: Jun '10
    Posts: 4

    offline

    hello, i want to ask is there any plugin which allow admin to post content with any other username

    like when adding a new topic
    there should a textbox to accept username
    admin will enter username in that textbox
    and after submitting the topic will be posted and author will be the username entered by admin

    Posted 1 year ago #
  2. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 908

    offline

    This plugin will allow you to change the author afterwards:

    http://bbpress.org/plugins/topic/edit-post-attributes/

    Posted 1 year ago #
  3. netjockey
    User has not uploaded an avatar

    new member
    Joined: Jun '10
    Posts: 4

    offline

    yes i know that,but i want to change author while posting new topic and an new replies, i am trying to edit your plugin

    i have made this changes

    add_action( 'bb_new_topic', 'edit_post_attributes_save',8);
    add_action('post_form','edit_post_attributes_form',8);

    the edit form is now visible while posting new reply and new topic

    the problem i need to change the code so to insert the topic as well can you help me and tell me

    Posted 1 year ago #
  4. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 908

    offline

    Sorry that's far too obscure of a need than I care to work on.

    You could try changing the action hook from 'bb_update_post' (or your attempt at 'bb_new_topic') to 'bb_insert_post' but there are probably a few other issues that have to be addressed before it would work.

    Posted 1 year ago #
  5. netjockey
    User has not uploaded an avatar

    new member
    Joined: Jun '10
    Posts: 4

    offline

    ya thanks for the guidance ,i try to do it

    Posted 1 year ago #
  6. netjockey
    User has not uploaded an avatar

    new member
    Joined: Jun '10
    Posts: 4

    offline

    hello, i tried that but unsuccessful

    add_action( 'bb_insert_post', 'edit_post_attributes_save',8);
    add_action('post_form','edit_post_attributes_form',8);

    function edit_post_attributes_save() {
    global $edit_post_attributes;
    global $bbdb, $bb_cache; $fields=array(); $topic_fields=array();
    $bb_post=bb_get_post($post_id);
    if (!empty($_POST['poster_login'])) {
    $poster_login=sanitize_user($_POST['poster_login']);
    $poster_id = intval($bbdb->get_var( $bbdb->prepare("SELECT ID FROM $bbdb->users WHERE user_login = %s", $poster_login ) ) );
    if (!empty($poster_id) && $poster_id!=$bb_post->poster_id) {$fields[]="poster_id";}
    }
    if (!empty($fields)) {
    $bbdb->insert( $bbdb->posts, compact( $fields ), compact( 'post_id' ) );
    }
    }

    what it is doing inserting an two post in database one with the uid i entered,i know the part in bold should be something else,can you help on it

    i have made a mod for mybb forum software for a same feature i needed in mybb


    $plugins->add_hook('datahandler_post_insert_post', 'admin_newreply');

    function admin_newreply(&$insert_data)
    {
    $insert_data->post_insert_data['uid'] = $fakeuid;
    $insert_data->post_insert_data['username'] = $fakeusername;
    }

    in mybb i am just attaching my values to the default data handler by using hooks

    can you guide me, how can i pass my values to bbpress datahandler

    Posted 1 year ago #
  7. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 908

    offline

    Don't be fooled by the name $bbdb->insert, it also just updates.

    My plugin changes the info after the post already exists.

    So what you need to make sure is first the post is saved, then change the info via the plugin.

    bb_insert_post fires after either a new post or an edit.

    But like I said, I am not working on this, your need is too obscure and doesn't help anyone else who wouldn't need such a feature.

    Posted 1 year ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

keep _ck_ coding >> donate $5 <<     Theme Switcher:
22 users online from in the past 30 minutes. 16 bots 6 guests
6,642 views today 8,426 yesterday 16,043 peak. Most at once 50 today 62 yesterday 131 peak. Visited today: Amylawrence, guava, JeffreyCasivant, wigbuy123, gdfddfs, nandao, _ck_, summerfortun
2,288 posts in 394 topics over 66 months by 430 of 2,167 members. Latest: watchessaleus, wigbuy123, JeffreyCasivant