MyBB Community Forums

Full Version: Group promotions bug
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Upon editing a group promotion for registered length, and then revisiting the group promotion then the entry that you insert changes to something else. For example, from 2 months to 2 days. In the database, the entry is "=" (see below screenshots) I have confirmed this across three sites: 
https://creatorswave.com/ https://forumauthority.com/ and https://www.atlasindustries.info/forum/
These sites are: 1.8.9(Creators Wave and Forum Authority) and 1.8.10(Atlas Industries)

SQL code on the updating of group promotions
SET `title`='Legend', `description`='Became a Legend', `posts`=10000, `posttype`='>', `threads`=0, `threadtype`='>', `registered`=100, `registeredtype`='=', `online`=10, `onlinetype`='years', `reputations`=0, `reputationtype`='>', `referrals`=0, `referralstype`='>', `warnings`=0, `warningstype`='>', `requirements`='postcount,threadcount,reputation,referrals,warnings,timeregistered,timeonline', `originalusergroup`='12', `newusergroup`=16, `usergrouptype`='primary', `enabled`=1, `logging`=1 WHERE pid = '11'

[Image: dfb15b25fd.png]

notice how registered type is still = while onlinetype works just fine.
The registertypes that have "months" were manually adjusted through the database. While the ones with = were saved from the admincp. Even if you edit it in the database and then you make an adjustment from the admincp and save... it'll change it back to =
I can confirm this bug. It seems to be caused by this bit of code in the add/edit section:

			$allowed_operators = array('>', '>=', '=', '<=', '<');
			$operator_fields = array('posttype', 'threadtype', 'timeregisteredtype', 'reputationtype', 'referralstype', 'warningstype');

			foreach($operator_fields as $field)
			{
				if(!in_array($mybb->get_input($field), $allowed_operators))
				{
					$mybb->input[$field] = '=';
				}
			}

Either we remove timeregisteredtype from the $operator_fields array or add the times to the $allowed_operators array.
Moving this to the bug reports forum since it's confirmed, thanks for checking Starpaul Smile
Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/2629

Thanks for contributing to MyBB!

Regards,
The MyBB Group