Jump to content

jktEG

New Members
  • Posts

    2
  • Joined

  • Last visited

jktEG's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Wait I just saw something, the developer might have mixed up two names, the above code is in a piece called New Thread, but I noticed the message in there was wrong, it said it was about making a reply to a post. So I checked the one called Reply to a Post, and found this: * @var modX $modx * @var Discuss $discuss * @var fiHooks $hook * @var string $submitVar * * @package discuss */ $discuss =& $modx->discuss; $modx->lexicon->load('discuss:post'); $fields = $hook->getValues(); unset($fields[$submitVar]); if (empty($fields['post'])) return $modx->error->failure($modx->lexicon('discuss.post_err_ns')); /** @var disPost $post */ $post = $modx->getObject('disPost',$fields['post']); if ($post == null) return false; /** @var disThread $thread */ $thread = $post->getOne('Thread'); if ($thread == null) return false; The above code looks good, but it seems to focus on determining whether a board has been specified...this seems closer to what I want...maybe.
  2. Hello All: I am not very familiar with php, and need some advice about how to do something. Really appreciate a little advice. I am making a forum with MODX, it has a module for forums called Discuss. Discuss has a built-in functionality to organize new topics into questions or discussions, regardless of the board a topic is in. So when you try to make a new topic it has got two buttons, question or discussion, and if you don't choose one it throws an error (its suppose to warn you but doesn't now). I want to remove this function completely, not because of the error but just because its not suitable for my site which is not a support site. I don't care if the system considers all posts as questions, or as discussions, I just want the users to not have to choose and they can just post their topics, no buttons, no choice, and no error. Removing the buttons is easy enough, but I need to change a little php to tell the system to either not need this info, or just give it a default variable so that the user can post (I don't know the variable names right now but that is next I guess). Anyway, here is the code which will probably be clearer than the above: $discuss =& $modx->discuss; $modx->lexicon->load('discuss:post'); $fields = $hook->getValues(); unset($fields[$submitVar]); if (empty($fields['board'])) return $modx->error->failure($modx->lexicon('discuss.post_err_ns')); $board = $modx->getObject('disBoard',$fields['board']); if ($board == null) return false; My first thought was to change the "If empty" line, and tell it, if empty then return (one of the two possible values). Then, everything would be ok, it seems to me. But could I also just strip out the check for the variable completely? If I took out the three lines starting with $fields all the way to the "If empty" line, wouldn't that mean the check is gone and the post will post without concern that this value doesn't exist? Or would this set off the system somehow (as it presumably never contemplated that this value would not be there)? Or, am I barking up the wrong tree here? Really looking forward to some advice about this. Thanks in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.