Additional Authors

Started by Diego Andrés, August 09, 2014, 07:36:48 PM

Previous topic - Next topic

Diego Andrés

Link to the mod

Additional Authors
If you need to report a bug, please do so on GitHub!

Ever wanted to collaborate on a first post with less privileged users? Didn't feel like giving them more permissions? Then this is the mod for you!
Additional Authors allows you to add any registered user to a first post. He/she can edit it like any other post.
Additionally, the mod displays a nice overview of mini-profiles of everyone involved in the post.

Features
- Additional mini-profiles on first post
- Easy to use interface
- Integration with the Display Additional Membergroups mod by margarett
* (if this feature is not available, the mod will still work correctly)
- Allow co-authors to edit the post

Changelog
v0.1
- Initial release

Planned features
- Switch for first/any post (currently only first post)

License:
This mod is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported license.

Permissions added
Yes, and disabled by default.

Files modified
- Sources/Display.php
- Sources/ManagePermissions.php
- Sources/Subs-Post.php
- Sources/Post.php
- Themes/default/Display.template.php
- Themes/default/Post.template.php
- Themes/default/css/index.css
- Themes/default/languages/Modifications.{language}.php

Tables added/modified
- {db_prefix}topics
* Column add_authors (text) will be added.

Languages available
- English
Translations are welcome!

SMF Tricks - Free & Premium Responsive Themes for SMF.

Mstcool


NanoSector

My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Mstcool


Skaty

Nice mod. I have installed with no errors. When i tried to open a new topic it is given me this error:


NanoSector

#5
Can you attach your Post.php file in your next post please?
ETA: Nevermind, found the bug. Will push a new package out in a few minutes, please uninstall the mod in the meantime :)

ETA2: Sorry for the delay, my home server was/is making weird noises so I had to create a backup. New package is attached to the mod page.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Jade Elizabeth

This is really neat! Does it work with avatars? What about member colour link? :)
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

NanoSector

Thanks Jade :)

Yes it works with avatars. Might make it work with member colours in the paid version, if that's a mod.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Jade Elizabeth

Sweet, I am considering using it and molesting my display template. I think it would work exceptionally well on my forum :D.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Ninja ZX-10RR

Nice MOD NanoSector!
I would like to install it as well but it fails here in sources/post.php
Code (find) Select

t.id_first_msg, mf.subject,


Code (add after) Select

t.add_authors,


and also here in Themes/default/post.template.php

Code (find) Select

', $context['show_approval'] ? '<li><label for="approve"><input type="checkbox" name="approve" id="approve" value="2" class="input_check" ' . ($context['show_approval'] === 2 ? 'checked="checked"' : '') . ' /> ' . $txt['approve_this_post'] . '</label></li>' : '', '
</ul>
</div>';


Code (replace) Select

', $context['show_approval'] ? '<li><label for="approve"><input type="checkbox" name="approve" id="approve" value="2" class="input_check" ' . ($context['show_approval'] === 2 ? 'checked="checked"' : '') . ' /> ' . $txt['approve_this_post'] . '</label></li>' : '', '
', $context['can_add_authors'] ? '<li><label for="addAuthors">Additional authors: <input type="text" name="addAuthors" id="addAuthors" class="input_text"></input></label><div id="author_container"></div></li>' : '', '
</ul>
</div>';

// Additional authors mod - JavaScript
if ($context['can_add_authors'])
{
echo '<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
<script type="text/javascript"><!-- // -->
var oAuthorSuggest = new smc_AutoSuggest({
sSelf: \'oAuthorSuggest\',
sSessionId: \'', $context['session_id'], '\',
sSessionVar: \'', $context['session_var'], '\',
sSuggestId: \'addAuthors\',
sControlId: \'addAuthors\',
sSearchType: \'member\',
bItemList: true,
sPostName: \'add_authors\',
sURLMask: \'action=profile;u=%item_id%\',
sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
sItemListContainerId: \'author_container\',
aListItems: [';

if (!empty($context['add_authors']))
foreach ($context['add_authors'] as $id_member => $member_name)
echo '
{
sItemId: ', JavaScriptEscape($id_member), ',
sItemName: ', JavaScriptEscape($member_name), '
}', $id_member == $context['add_authors'] ? '' : ',';

echo '
]
});
// ]]></script>';
}


I can't figure out how to fix those errors and it's probably due to the other 90+ mods installed, can you help me if you have some time? :)
*attached both faulty files*
Thanks in advance anyway!
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

ryan_dwight

Thank you for this great mod.

I installed on my forum with blacknblack theme. I managed to edit the display template and it was successfully appeard on the post but how can I change the color or the background fo the additional author? It is a white box same as the default theme but I am using a black theme. Is it possible to make it same as my theme?

NanoSector

Sure, what colour would you like it to be?
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

NanoSector

Quote from: ♦ Ninja ZX-10RR ♦ on August 26, 2014, 08:46:10 PM
Nice MOD NanoSector!
I would like to install it as well but it fails here in sources/post.php
Code (find) Select

t.id_first_msg, mf.subject,


Code (add after) Select

t.add_authors,


and also here in Themes/default/post.template.php

Code (find) Select

', $context['show_approval'] ? '<li><label for="approve"><input type="checkbox" name="approve" id="approve" value="2" class="input_check" ' . ($context['show_approval'] === 2 ? 'checked="checked"' : '') . ' /> ' . $txt['approve_this_post'] . '</label></li>' : '', '
</ul>
</div>';


Code (replace) Select

', $context['show_approval'] ? '<li><label for="approve"><input type="checkbox" name="approve" id="approve" value="2" class="input_check" ' . ($context['show_approval'] === 2 ? 'checked="checked"' : '') . ' /> ' . $txt['approve_this_post'] . '</label></li>' : '', '
', $context['can_add_authors'] ? '<li><label for="addAuthors">Additional authors: <input type="text" name="addAuthors" id="addAuthors" class="input_text"></input></label><div id="author_container"></div></li>' : '', '
</ul>
</div>';

// Additional authors mod - JavaScript
if ($context['can_add_authors'])
{
echo '<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
<script type="text/javascript"><!-- // -->
var oAuthorSuggest = new smc_AutoSuggest({
sSelf: \'oAuthorSuggest\',
sSessionId: \'', $context['session_id'], '\',
sSessionVar: \'', $context['session_var'], '\',
sSuggestId: \'addAuthors\',
sControlId: \'addAuthors\',
sSearchType: \'member\',
bItemList: true,
sPostName: \'add_authors\',
sURLMask: \'action=profile;u=%item_id%\',
sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
sItemListContainerId: \'author_container\',
aListItems: [';

if (!empty($context['add_authors']))
foreach ($context['add_authors'] as $id_member => $member_name)
echo '
{
sItemId: ', JavaScriptEscape($id_member), ',
sItemName: ', JavaScriptEscape($member_name), '
}', $id_member == $context['add_authors'] ? '' : ',';

echo '
]
});
// ]]></script>';
}


I can't figure out how to fix those errors and it's probably due to the other 90+ mods installed, can you help me if you have some time? :)
*attached both faulty files*
Thanks in advance anyway!
Try the attached files. It was indeed a mod conflict.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

ryan_dwight


Ninja ZX-10RR

Quote from: NanoSector on August 28, 2014, 10:49:57 AM
Try the attached files. It was indeed a mod conflict.
Awesome dude, it was a bit too complicated for me to solve it, it seems to be working perfectly now :D thanks a lot! I will tell you if something appears in the error log ;) thanks again!
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Ninja ZX-10RR

Got another problem while using "Delete spam post" mod, I don't know if it is a conflict between the 2 but I got this:
Quote
index.php?action=deletespampost;topic=86.1;msg=147
Undefined index: add_authorsApply Filter:
File: /Sources/Subs-Post.php
Line: 2563
Any clues? >_< thanks in advance, sorry for being criptic, gotta go in a minute
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

NanoSector

Seems to be an issue in both :)
Delete spam post doesn't fill in the add_authors key in $topicOptions causing this error because my mod doesn't check it the proper way. :)
I'll fix it tomorrow but it's not high priority.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Ninja ZX-10RR

Yup, thanks again, no problem :D sorry for being so much annoying about it xD
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

NanoSector

To probably fix it yourself in the meantime, change:
|| $topicOptions['add_authors'] !== null)
to
|| !empty($topicOptions['add_authors']))
in that file.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Ninja ZX-10RR

Indeed it worked I just tested it :D thanks a lot for the ultra-fast fix!!!
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Advertisement: