An option is needed if user needs to stop using GA with drupal. Currently there is option to renew the GA code, but not to disable it for a user.

CommentFileSizeAuthor
#5 delete-codes-1949948-5.patch7.01 KBK.MacKenzie

Comments

attiks’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Category: bug » feature

Good idea, can you provide a patch?

K.MacKenzie’s picture

I actually have this working within a custom module (and built into a very custom user interface).

I would be happy to incorporate my change into the contrib module and contribute a patch, but how do you see the best way to implement this in the user interface?

I was thinking a checkbox on the user/edit page

[ ] Delete this users GA Login code

Then it would just do a simple db_delete('ga_login')->conditions('username', $username)->execute(); and push a drupal_set_message on form submit.

What do you think, Attiks?

attiks’s picture

UX wise I think a button would be better, combined with a confirmation page. Ideally we would go through the ga class to handle the delete, but not sure if it's supported.

Patches are very welcome

K.MacKenzie’s picture

I would agree that going through the ga class to handle the delete is the best route, the function itself would need to be added to the class though because there isn't one currently.

The button/confirmation sounds good too, my only trouble now is finding the time to do this. Hopefully next weekend.

Cheers,

K.MacKenzie’s picture

Status: Active » Needs review
StatusFileSize
new7.01 KB

Hey,

Sorry it took me so long.

I have never installed a confirmation form through hook_form_alter before and I ran into a weird snag trying to set up the confirmation form as a switch within the main form; the submit wouldn't call my custom function. To work around this I simply made a new page and form and redirected to that. Attiks, if you know of a better way I would be really interested to hear it, but I think this will suffice just fine.

Notice that in order for this to work the user needs either delete own code permission or delete others code permission.

Also, I didn't put the delete function inside the ga_login class because I didn't understand the benefit and I wasn't sure if this is what you meant. If you think the function should be inside the class rather than the module file let me know and I will update the patch.

Here is the patch.

attiks’s picture

Status: Needs review » Fixed

Thanks for the patch, I made some minor changes

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.