Gossamer Forum
Home : Products : DBMan : Customization :

I want Userid who own IDs can delete ReplyID of th

Quote Reply
I want Userid who own IDs can delete ReplyID of th
"I want Userid who own IDs can delete ReplyID of that ID"

HI, i restarted to do users comment mod again by using
User Comments/ Reviews(database does not use the Userid field as the key).:http://webmagic.hypermart.net/dbman/multi31.txt
R E L A T I O N A L D A T A B A S E S:http://www.jpdeni.com/dbman/Mods/relational.txt
Both instruction have no option i need.

Both of MY databases do not use Userid field as the key,i have only two dbs that are key field ,one is ID for topic database and other is ReplyID for reply database
It works fine at this moment but i wonder,

How can I allow user who post the ID can modify or delete reply records post by default users.

I tested reply to ID by default user ,and the reply database look like this;

4|22|reter||24-02-2001|retretr|||Yes|||default

If user who own this ReplyID is default ,So how to make the topicID owner can del or modify the reply records post by default users?

below is what in my .cgi file;
sub switch_to_reply {
#-----------------------------------------------------

$cols = 'ID,ReplyID,ReplyName,ReplyBgColor,ReplyDate,ReplyMessage,ReplyEmail,ReplyICQ,ReplyValidated,ReplyPopular,YourUsername,Userid';
@db_cols = split /,/,$cols;
$db_file_name = $db_script_path . "/reply.db";
$db_sort{'ReplyDate '} = 'date';
}

sub switch_to_topic {
#-----------------------------------------------------

$cols = 'ID,Name,Age,Location,Email,mm,ICQ,dd,Homepage,Date,Info,Userid,Sex,Graphic,Rating,Votes, yyyy,AllowEmail,Validated,Popular,Color,Province, AllowPostReply';
@db_cols = split /,/,$cols;
$db_file_name = $db_script_path . "/topic.db";
$db_key_pos = 0;
}

code i added to reply.html at sub html_record_form
after my (%rec) = @_;

##############
if ($in{'ID'}) {
$rec{'ID'} = $in{'ID'};
}

and code i added in topic.html at sub html_record_long

if ($rec{'AllowPostReply'} eq "Y") {
print qq|<tr>
<td width="100%">
<a href="$db_script_url?db=reply&uid=$db_uid&ID=$rec{'ID'}&add_form=1">µÔªÁ˹è͹Ð</a></font></td>
</tr>|;
}

then in this sub at the bottom after |; before }add code

###add switch
# Tell DBMan to look in the other database
&switch_to_reply;
#Clear out any previous search terms
undef %in;

# Get rid of any bold tags that might be in the userid field

$rec{'ID'} =~ s/<.?B>//g;

# Look for items added by this user

$in{'ID'} = $rec{'ID'};
#add this for only validate show

#$in{'Validated'} = 'Yes';

# Sort the results by the DateAdded field, in descending order
$in{'sb'} = 5;
$in{'so'} = 'descend';
# Set the maximum number of hits per page to a large enough number to guarantee that all records will be returned
$in{'mh'} = 100;
# Do the search
my ($status2,@hits2) = &query("view");
# If there are any search results
if ($status2 eq "ok") {
# Calculate the number of records returned
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);
# Set up a table for the display
print qq|<table cellpadding=0 cellspacing=0 border=1>|;
# Go through each hit and print out the results
for (0 .. $numhits2 - 1) {
# Break the array into a hash for printing
%rec2 = &array_to_hash($_, @hits2);
# Print out the link to the full item record
# Note that I am using $db_script_url and *not* $db_script_link_url.
print qq|
<tr><td>$rec2{'ReplyID'}
</td></tr> |;
}
print qq|</table>|;
}
# Tell DBMan to go back to the original database
&switch_to_topic;


Any help would be great appreciated.


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: I want Userid who own IDs can delete ReplyID of th In reply to
HI again :)

I have spent 3 hours both searching all the FAQ and using the old trial and effort method but Im still not getting any further. Could any one help me how to allow topic owner be able to delete reply records,if reply record post(own) by default :(


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: I want Userid who own IDs can delete ReplyID of th In reply to
I'm not sure i'm understanding what you want to do. You allow anyone to post replies, but you want the owner of the record to be able to delete replies made by other users?

I don't see how this could be done other than them having admin permissions? Or perhaps by setting up a different permission to allow deletions?



Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: I want Userid who own IDs can delete ReplyID of th In reply to
:) Hi ,LoisC
I have 2 database,one call topic and other call reply,
registered user make topic and unregistered visitors can reply to his topic.Then I dont know how to allow topic owner to be able to delete reply of that topic.I look at the database of reply,it look like this
4|22|reter||24-02-2001|retretr|||Yes|||default

Instead of default,how can it be Userid,the Userid who own that topic so owner can login to delete it .

I want topic owner manage his own reply.Is it clear?
I try add some code to sub html_record_form of reply.html but it not work.The default still default.
Any help would be great appreciated :)) I search for this solution at this forum and your Unoffical DBMan FAQ but not found.


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: I want Userid who own IDs can delete ReplyID of th In reply to
Hi,this is code in reply,sub html_record_form

if ($in{'add_form'}) {
&switch_to_topic;
#get record from associated field
%rec2=&get_record($rec{'ID'});
&switch_to_reply;
$rec{'Userid'} = $rec2{'Userid'};
$rec{'referinfo'} = $rec2{'info'};


but topic database still has Userid as default.,adn also no referinfo field added to reply database.
Anyone know what is the trick for this solution :(( I 'd be great appreciated if you can help.


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: I want Userid who own IDs can delete ReplyID of th In reply to
Earlier you stated:
Both of MY databases do not use Userid field as the key

I don't see how you are trying to associate the records so that it knows who is the owner.

Also you have Userid named in both databases, for relational databases you should have your field names unique in each database.

Perhaps checking out this thread will help provide some insight. http://gossamer-threads.com/p/89254


Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: I want Userid who own IDs can delete ReplyID of th In reply to
HI,LoisC
I think my need was a new solution never post before,topic owner can delete post of default user(relational database)
I have modified code as you comment but still can not success with Userid field of reply database.I changed common field to Userid and insert Userid field to the reply form.

For Userid field,I think it can not be anther but "default" if default user add record(Userid= $auth_user_field for both database).Is it possible to make a sub to insert Userid of Topic database into reply database?

Or if anyone have an idea to fix this out it would be appreciated.


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: I want Userid who own IDs can delete ReplyID of th In reply to
Hi there again,i still not work out this solution, if any one know how please help me.
Thank for your kind.


Please Excuse me for my poor knoledge of PERL
Regards,
Act.