Privacy Settings - Adding already added member results in database err

After you created a new privacy group you can add already added members again, which results in a "database error". Same happens if you later add all to the group.

Error Email send by dolphin:

 

Query:
INSERT INTO `sys_privacy_members` SET `group_id`='33', `member_id`='3'
Mysql error: Duplicate entry '33-3' for key 'group_member'

Found error in the file '/www/htdoc/inc/classes/BxDolPrivacyQuery.php' at line 163.
Called 'query' function with erroneous argument #0.

.......

 

Is it possible to filter already added members out of the list so this cannot happen anymore? Any other workaround?

Thanks in advance

Check my GeoDistance, Watermark, TorBlock and Android Push Notifications mods | http://goo.gl/H3Vp81
Quote · 16 May 2012

The exact error message

 

Error
Database query error

 

I can see the problem in the code because there is no check if the user already exists. Before i apply some kind of silly quick fix i really would like to know if it can be done in some calls before. So it's a really clean solution.

Currently i use the ON DUPLICATE KEY UPDATE statement to workaround the error on line 163. I would be happy if Boonex could provide a real fix for it, so the user not even gets displayed in the add list if already added to this group.

$iCount += $this->query("INSERT INTO `sys_privacy_members` SET `group_id`='" . $iGroupId . "', `member_id`='" . (int)$iMemberId . "' ON DUPLICATE KEY UPDATE `group_id` = `group_id`, `member_id`  = `member_id`");

Check my GeoDistance, Watermark, TorBlock and Android Push Notifications mods | http://goo.gl/H3Vp81
Quote · 16 May 2012

Thank you for the report:

Ticket #2789

I would suggest to make the following modification:

$iCount += $this->query("INSERT IGNORE INTO `sys_privacy_members` SET....

Rules → http://www.boonex.com/terms
Quote · 17 May 2012

Thanks Alex,

do i also have to make the other two changes for the files

templates/base/adminActionsPanel.html

templates/base/scripts/BxBasePrivacyView.php

which are mentioned in the ticket or is this only for 7.1?

Check my GeoDistance, Watermark, TorBlock and Android Push Notifications mods | http://goo.gl/H3Vp81
Quote · 17 Aug 2012

 Yes, it is better to apply all changes from the changeset.

Thanks Alex,

do i also have to make the other two changes for the files

templates/base/adminActionsPanel.html

templates/base/scripts/BxBasePrivacyView.php

which are mentioned in the ticket or is this only for 7.1?

 

Rules → http://www.boonex.com/terms
Quote · 17 Aug 2012

I asked because the code lines in templates/base/adminActionsPanel.html look so different. So i am not sure if i can just change it there. I guess i have to leave this button_wrapper construction

7.0.9

<div class="input_wrapper input_wrapper_submit">
<div class="button_wrapper"><input class="form_input_submit" type="{type}" name="{name}" value="{value}" {onclick} />

<div class="button_wrapper_close"></div>
</div>

7.1.0

<button class="bx-btn bx-btn-small" type="{type}" name="{name}" value="{value}" {onclick} >{value}</button


As you can see the value="{value}" is already in 7.0.9. But where to put this {value} from 7.1.0 which is encapsulated by this new button class ? Right before <div class="button_wrapper_close"> or is this something specific to 7.1.0?

Check my GeoDistance, Watermark, TorBlock and Android Push Notifications mods | http://goo.gl/H3Vp81
Quote · 18 Aug 2012

 Sorry, this change should be omitted for 7.0.9.

I asked because the code lines in templates/base/adminActionsPanel.html look so different. So i am not sure if i can just change it there. I guess i have to leave this button_wrapper construction

7.0.9

<div class="input_wrapper input_wrapper_submit">
<div class="button_wrapper"><input class="form_input_submit" type="{type}" name="{name}" value="{value}" {onclick} />

<div class="button_wrapper_close"></div>
</div>

7.1.0

<button class="bx-btn bx-btn-small" type="{type}" name="{name}" value="{value}" {onclick} >{value}</button


As you can see the value="{value}" is already in 7.0.9. But where to put this {value} from 7.1.0 which is encapsulated by this new button class ? Right before <div class="button_wrapper_close"> or is this something specific to 7.1.0?

 

Rules → http://www.boonex.com/terms
Quote · 19 Aug 2012
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.