jktEG Posted April 13, 2014 Share Posted April 13, 2014 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! Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.