Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
-FP Posted July 31, 2015 Posted July 31, 2015 The issue:The database stores comments in forum topics. A regular user of the Members group submits a record to the database, and it has to be approved before it's shown.When a moderator approves the record, the author of the first post of the generated topic is the moderator who approved the record, instead of the user who submitted the record, even though the topic says it was initiated by the user who submitted the record.----So, in /applications/cms/sources/Records/Records.php there's this code:/* Create topic */ $topic = \IPS\forums\Topic::createItem( $this->author(), \IPS\Request::i()->ipAddress(), \IPS\DateTime::ts( $this->record_publish_date ? $this->record_publish_date : $this->record_saved ), \IPS\forums\Forum::load( $this->_forum_forum ), $this->hidden() ); $topic->title = $this->_forum_prefix . $this->_title . $this->_forum_suffix; $topic->topic_archive_status = \IPS\forums\Topic::ARCHIVE_EXCLUDE; $topic->save(); if ( \IPS\Settings::i()->tags_enabled ) { $topic->setTags( $this->prefix() ? array_merge( $this->tags(), array( 'prefix' => $this->prefix() ) ) : $this->tags() ); } /* Create post */ $content = \IPS\Theme::i()->getTemplate( 'submit', 'cms', 'front' )->topic( $this ); \IPS\Member::loggedIn()->language()->parseOutputForDisplay( $content ); $post = \IPS\forums\Topic\Post::create( $topic, $content, TRUE, NULL, NULL, $this->author(), \IPS\DateTime::ts( $this->record_publish_date ? $this->record_publish_date : $this->record_saved ) ); $post->save(); $topic->topic_firstpost = $post->pid; $topic->save(); $topic->markRead(); /* Update file */ $this->record_topicid = $topic->tid; $this->save(); Both $topic and $post use $this->author(), so I'm not sure if the problem is in there or coming from somewhere else... maybe there's something in the code responsible for approving the record prior to generating the topic, but I can't find that.(Yes, I've made a support ticket but today is friday so I don't expect them to take a look before 4 or 5 days).
-FP Posted July 31, 2015 Author Posted July 31, 2015 Actually, I realized this is working now, I copied that code from a file IPS sent me yesterday to fix something else, and this works.The old code is like this:$post = \IPS\forums\Topic\Post::create( $topic, $content, TRUE, NULL, NULL, NULL, \IPS\DateTime::ts( $this->record_publish_date ? $this->record_publish_date : $this->record_saved ) );Had to replace the third NULL with $this->author().
Recommended Posts
Archived
This topic is now archived and is closed to further replies.