News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Reason For Editing Mod

Started by Nibogo, May 23, 2006, 12:44:11 AM

Previous topic - Next topic

dimspace

its in mine.

the full section of code is

// What?  It's not like it *couldn't* be only guests in this topic...
if (!empty($posters))
loadMemberData($posters);
$messages_request = $smcFunc['db_query']('', '
SELECT
id_msg, icon, subject, poster_time, poster_ip, id_member, modified_time, modified_name, body, edit_reason,
smileys_enabled, poster_name, poster_email, approved,

' . ($board_info['thank_you_post_enable'] && allowedTo('thank_you_post_show') ? 'thank_you_post, thank_you_post_counter,' : '') . '
id_msg_modified < {int:new_from} AS is_read
FROM {db_prefix}messages

WHERE id_msg IN ({array_int:message_list})
ORDER BY id_msg' . (empty($options['view_newest_first']) ? '' : ' DESC'),
array(
'message_list' => $messages,
'new_from' => $topicinfo['new_from'],
)
);


maybe youve got a mod that has changed that line slightly.

On a side note, the verification on here drives me nuts, it generally takes me about 12 attempts to work out what the letters are.. does it go away after ten posts or something :S

nixlike

I was afraid already that it might be what I found already when I crawled around the code lines to manually replace it. To be honest I have no idea which mod could have changed that and why, see my code here:


// What?  It's not like it *couldn't* be only guests in this topic...
if (!empty($posters))
loadMemberData($posters);
$messages_request = $smcFunc['db_query']('', '
SELECT
m.id_msg, m.icon, m.subject, m.poster_time, m.poster_ip, m.id_member, m.modified_time, m.modified_name, m.body,
m.smileys_enabled, m.poster_name, m.poster_email, m.approved,
m.id_msg_modified < {int:new_from} AS is_read, k.message AS is_repped
FROM {db_prefix}messages AS m
LEFT JOIN {db_prefix}log_karma AS k ON (k.message = m.id_msg AND k.id_executor = {int:current_member})
WHERE m.id_msg IN ({array_int:message_list})
ORDER BY m.id_msg' . (empty($options['view_newest_first']) ? '' : ' DESC'),
array(
'message_list' => $messages,
'new_from' => $topicinfo['new_from'],
'current_member' => $user_info['id'],
)
);


So according to the installer file, the only thing that needs to be done is to have edit_reason added to that list. Now in my case I'm unsure if to just put edit_reason or m.edit_reason there. Maybe you are able to point me to the right spot once more dimspace :)

//edit
Looking at the code part again makes me wonder if this could have been the reputation mod...  ???

dimspace

the m prefix is because thats how things are in your database table, so in the members table you have things prefixed with an m ie.    m.id_msg   m.id_topic   m.id_board   m.poster_time   m.id_member   

in theory, the database entry for reason for editing, should still be edit_reason but it may be that it goes into your database as m.edit_reason

two ways to find out, look in the database under phpmyadmin and located the table after doing the routine to the database.

Or do what I do, download display.php
MAKE A COPY
Make the change to the copied file and upload it
If it doesnt work or gives you a database error that it cant find the line then quickly re-upload the original php file back up again.

Kindred

what it looks like is that the reputation or some similar mod alreayd made changes to that section and since it's joining data from a second table to the list of variables, it had to identify the message table (m.) and the new table (k.)

add the edit_reason as m.edit_reason

e.g.
m.modified_time, m.modified_name, m.body, m.edit_reason,
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

nixlike

That's what I thought so far, personally for other projects I completely coded on my own I used `tablename`.`rowname` for multiple table/row access within a single query. It's much better to have another person looking through it to make sure I dont push things down the stairs ^^

Backup copies are always available plus I never go productive without intensive testing on my local dev environment :)
I'll go and check out your suggestions and reply later on. Thanks already so far!

@Kindred: Great, so all in all it sounds like a plan. I'll be back later with news on this one.

nixlike

Ok guys, this is kind of funny lol. Installed the mod, edited Display.php manually, looks fine and no errors so far. But ... theres no input box to enter the edit reason. So I went into the code, Post.template.php this time to do some testing and to see whats causing the missing input box.

Replaced
if ((!$context['is_new_post']) && (allowedTo('reason_edit')))

with
if ((!$context['is_new_post']))

And bloop, there is the line. So usually anyone reading that would go like "Have you set the correct permissions?". Let me answer that with: Yes, I have. First I applied the new permission only to the membergroup my username is in but since my trial and error testing I granted that permission to all membergroups on my devel environment. Same thing, the input box does not appear with the && (allowedTo('reason_edit'))) part.

Is it me who is missing something?

//edit
For the purpose of the functions I can say it works. The only thing I'm a bit confused about is the fact that - once edited with a reason - the reason applied before doesnt show up in the input box. Is this supposed to be like that?

Kindred

it would not re-fill the input box with a previous edit reason....
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

dimspace

the code in my post.template is as per the mod parser

// Reason for Editing Mod
    if ((!$context['is_new_post']) && (allowedTo('reason_edit')))
    echo '
<div class="padding smalltext">


which includes the && allowed to.

If you are using utf-8 make sure you have done the manual edits to Modifications.english-utf8.php etc. Im finding a lot of mods where that isnt auto installing and is causing problems down the line.

dimspace

Quote from: Kindred on April 17, 2012, 01:36:42 PM
it would not re-fill the input box with a previous edit reason....

yeh, ive found that, tis a bit annoying that it doesnt remember it.

hurrah.. ive reached ten posts, no more idiotic verification that it takes me twenty attempts to read.

Kindred

well, it would have to do a database call and fill in order to find the last entered reason...

If you're editing it again, in theory, it's for another reason.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

nixlike

Alright, the edit reason being put into the box at new edit isn't a big deal since - as you say Kindred - it's most probably a different reason when you're editing again.
Regarding the utf-8 suggestion - let me ask a dumb question: how do I find out if I'm running on utf8 or not?

Congratz to your breaking-the-10th-post-and-now-be-running-without-verification dimspace :D

dimspace

just have a look in your /Themes/default/languages/ directory and see if you have Modifications.english-utf8.php (thats the only related utf-8 file)

Not sure how you do your manual editing. I do all of mine using FTP.
I download all the files to be changed, and sort them into an exact directory structure on my computer.
I then make a copy of the whole lot, make the edits, and then can upload all the changed files in one go.
Then if it screws up i can just in a matter of seconds upload the original files in one go again.

nixlike

If this is an indicator then I dont have any utf8 files in my language directory at all. I'm thinking of possible solutions now and right now I'm wondering if that permission check is required at all as I run a registered members only board anyway. Of course I'd be happy if that permission stuff works out as supposed but better to have it working at all than dont have anything working - what's your opinion about it (as I dont seem to be able to hunt down the cause properly enough)?

The way you do it was the way I once did it as well but it got a bit sucky for lots of small edits, trials and error testing processes. Running wamp with an exact copy of all the files online, using notepad++ for proper file editing :)

//edit
I chose to go hand in hand with the dont-check-the-permissions solution, works out great! Thanks to dimspace and Kindred for some appropriate and highly appreciated help, thumbs up :)

Steve

DO NOT pm me for support!


Steve

When I try to install it the Package Manager tells me it's not compatible with my version of SMF (2.0.3).  :-\
DO NOT pm me for support!


Steve

DO NOT pm me for support!

MoreBloodWine

This is labeled to work with 2.0.3 but there is no install link... I tried modifying the xml to reference 2.0.3 along with he other versions but that seemed to not even have the mod show in the package list. It's been a while since I modified an XML but I dont believe I did it wrong since I mirrored what was already there.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Arantor

Check what version you have listed in the Emulate area, Admin > Main > Package Manager > Advanced (right at the bottom)

Advertisement: