vForums Support > Programming & Coding :: Code Requests & Support :: > [F] Alert box when attempting pm staff

[F] Alert box when attempting pm staff - Posted By Tim (grievous) on 6th Mar 08 at 9:53pm
Could I get a code to where When a member tries to pm a staff member an alert box comes up with a message that I put.?

Re: Alert box when attempting pm staff - Posted By Michael (wrighty) on 6th Mar 08 at 9:56pm
Try this:

<script>
function pm_user(member, message){
    if(location.href.match(/\/pm_send\//) && location.href.match(member)){
        alert(message);
    }
}

pm_user('admin', 'Please Do Not PM the Admin!');
pm_user('god','I really am not God!');
</script>


Main Header

Untested, try it! {Smile}

Re: Alert box when attempting pm staff - Posted By Tim (grievous) on 6th Mar 08 at 10:03pm
Will staff members see this alert as well?

Heres how I did it.

<script>
function pm_user(member, message){
if(location.href.match(/\/pm_send\//) && location.href.match(member)){
alert(message);
}
}

pm_user('admin', 'Please only PM me if you wanna say HI or if theres a conflict between member and staff.
Thanks.');
pm_user('masonfett','IPlease do not pm me regarding support issues or to request a graphic. All graphic request go in graphics section.
Thanks.');
</script>

Re: Alert box when attempting pm staff - Posted By Michael (wrighty) on 6th Mar 08 at 10:13pm
Yes staff will see them as well.

Re: Alert box when attempting pm staff - Posted By Tim (grievous) on 7th Mar 08 at 3:14am
Well, it's not working, and again, heres how the code is.

<script>
function pm_user(member, message){
if(location.href.match(/\/pm_send\//) && location.href.match(member)){
alert(message);
}
}

pm_user('admin', 'Please only PM me if you wanna say HI or if theres a conflict between member and staff.
Thanks.');
pm_user('masonfett','IPlease do not pm me regarding support issues or to request a graphic. All graphic request go in graphics section.
Thanks.');
</script>

Re: Alert box when attempting pm staff - Posted By Marc (cr0w) on 7th Mar 08 at 3:39am
 
Well, it's not working, and again, heres how the code is.

<script>
function pm_user(member, message){
if(location.href.match(/\/pm_send\//) && location.href.match(member)){
alert(message);
}
}

pm_user('admin', 'Please only PM me if you wanna say HI or if theres a conflict between member and staff.
Thanks.');
pm_user('masonfett','IPlease do not pm me regarding support issues or to request a graphic. All graphic request go in graphics section.
Thanks.');
</script>


You can't have line breaks in the code, rather than pressing Enter, type \n. {Wink}

Re: Alert box when attempting pm staff - Posted By Tim (grievous) on 7th Mar 08 at 4:16am
*high-fives Marc and Wrighty*

Thanks guys, it worked perfectly!!!!!