Posted by
juanete on
URL: https://support.nabble.com/Delete-banned-users-tp7586705p7587689.html
Hi Silvana.
I've done it in the following way and administrators can see the IP of the users on your profile:
1- At the bottom of your app-> See "Edit this page" or "naml".
2- At the engine wheel -> "Go to Advanced Editor" .
3- Add new file named "
extra_profile_fields"
4- add the following code:
<macro name="extra_profile_fields" requires="user,servlet">
<n.set_local_user.this_user />
<!-- Listing the fields already filled -->
<n.this_user.list_extra_fields/>
</macro>
<macro name='list_extra_fields' requires='user'>
<!-- Ip property-->
<n.if.this_user.has_property name="ip">
<then>
<br/>
<strong>IP: </strong><n.this_user.get_property name="ip"/>
</then>
</n.if.this_user.has_property>
</macro>
5- Then, edit your "
profile_header" macro.
On line 13 the following code searches:
...
<n.if.both condition1="[n.visitor.is_site_admin/]" condition2="[n.local_user.is_authenticated/]">
<then>
<strong>Email</strong>: <n.local_user.user_email/>
</then>
</n.if.both>
...
And paste between the tags "then" the following line:
<n.local_user.extra_profile_fields/>
Must be as follows:
...
<n.if.both condition1="[n.visitor.is_site_admin/]" condition2="[n.local_user.is_authenticated/]">
<then>
<strong>Email</strong>: <n.local_user.user_email/>
<n.local_user.extra_profile_fields/>
</then>
</n.if.both>
...
The complete code for the macro is:
<override_macro name="profile_header" requires="user">
<n.set_local_user.this_user />
<n.block.>
<div class="second-font shaded-bg-color rounded" style="font-size:170%;padding:.2em .5em;margin-left:.1em">
<n.local_user.name/>
</div>
<table>
<tr valign="top">
<td><n.local_user.avatar size="big"/></td>
<td style="width:100%;padding-left:.5em">
<n.if.both condition1="[n.visitor.is_site_admin/]" condition2="[n.local_user.is_authenticated/]">
<then>
<strong>Email</strong>: <n.local_user.user_email/>
<n.local_user.extra_profile_fields/> <!--PASTE THIS LINE TO SHOW THE IP-->
</then>
</n.if.both>
<n.if.local_user.is_banned>
<then>
<n.local_user.banned_label/>
</then>
<else>
<n.local_user.registration_label/>
<n.local_user.list_current_groups/>
<n.if.not.local_user.is_deactivated>
<then.local_user.send_email_to_user_link/>
</n.if.not.local_user.is_deactivated>
</else>
</n.if.local_user.is_banned>
<!-- If this is the profile of the visitor -->
<n.if.visitor.equals.local_user>
<then>
<!-- if the user is authenticated -->
<n.if.local_user.is_authenticated>
<then.local_user.authenticated_self_profile_header/>
<else>
<div style="margin-top:.5em">
<t><n.register_link.>Register now</n.register_link.> if you want to edit your profile, receive posts via email,control your starred items or have access to your global profile.</t>
</div>
</else>
</n.if.local_user.is_authenticated>
</then>
<else>
<n.if.visitor.can_manage_banned_users>
<then>
<div style="margin-top:.5em">
<img src="/images/icon_blocked.png" class="image16" style="margin:0 1px"/>
<n.if.local_user.is_banned>
<then><a href="[n.local_user.unban_path/]"><t>Unban this user</t></a></then>
<else><a href="[n.local_user.ban_path/]"><t>Ban this user</t></a></else>
</n.if.local_user.is_banned>
</div>
</then>
</n.if.visitor.can_manage_banned_users>
</else>
</n.if.visitor.equals.local_user>
</td>
</tr>
</table>
</n.block.>
</override_macro>
6- For Getting the ip address from a visitor, Edit the macro "
new_post".
Below the line 10:
...
<else>
...
Paste the following line:
<n.visitor.set_property name="ip" value="[n.now.long_format/] : [n.visitor_ip_address/]" />
The complete code for the macro is:
<override_macro name="new_post" parameters="page_name,mailing_list_etiquette,bottom,focus" requires="servlet">
<n.node_page.>
<n.handle_new_node_permission_error/>
<n.if.not.is_submitted_form>
<then>
<n.subject_field.set_value value="[n.page_node.default_reply_subject/]" />
<n.alert_field.set_value value="[n.page_node.alert_default_value/]" />
<n.init_new_post_custom_fields/>
</then>
<else>
<n.visitor.set_property name="ip" value="[n.now.long_format/] : [n.visitor_ip_address/]" /> <!--PASTE THIS LINE TO GET IP-->
<n.catch_exception. id="save-block">
<n.handle_anonymous_submit/>
<n.check_antispam_submit bypass="preview"/>
<n.check_recent_post_limit/>
<n.create_child_of_page_node commit="[n.not.is_preview/]">
<subject><n.subject_field.value/></subject>
<message><n.message_field.value/></message>
<is_html><n.html_format_field.value/></is_html>
<type><n.type_field.value/></type>
<kind>post</kind>
<do>
<n.remember_new_node/>
<n.if.not.is_preview>
<then>
<n.save_post/>
<n.save_new_post_custom_fields/>
<n.new_node.send_node_as_email/>
</then>
</n.if.not.is_preview>
</do>
</n.create_child_of_page_node>
<n.if.not.is_preview>
<then>
<n.new_node.save_alert_field/>
<n.redirect_to.new_node.url/>
</then>
</n.if.not.is_preview>
</n.catch_exception.>
</else>
</n.if.not.is_submitted_form>
<n.html>
<head>
<META NAME="robots" CONTENT="noindex,nofollow"/>
<n.title.><n.page_name/></n.title.>
<n.focus/>
<style type="text/css">
.title-row {
padding:.6em .8em;
font-weight:bold;
}
div.field-title {
margin-top: 0;
}
</style>
</head>
<body>
<n.edit_header first_text="[n.page_name/]" second_text="[n.truncate. size='80'][n.page_node.subject/][/n.truncate.]" />
<n.if.is_submitted_form>
<then>
<n.if.has_exception for="save-block">
<then.show_new_node_error/>
<else>
<n.if.is_preview>
<then.new_node.preview/>
</n.if.is_preview>
</else>
</n.if.has_exception>
</then>
</n.if.is_submitted_form>
<n.subscription_reminder/>
<n.form. onsubmit="return singleSubmit(this)">
<n.type_field.hidden/>
<n.mailing_list_notice.mailing_list_etiquette/>
<n.reply_form />
<div style="margin-top:1em">
<n.antispam_submit_button class="toolbar action-button" value="[t]Post Message[/t]"/>
<input type="submit" class="toolbar action-button" name="preview" value="[t]Preview Message[/t]"/>
<t>or</t>
<a href="[n.page_node.url /]"><t>Cancel</t></a>
</div>
</n.form.>
<n.hide_null.bottom/>
</body>
</n.html>
</n.node_page.>
</override_macro>
Now we just need to know how to block IP address. That I have no idea.
regards
“El software libre construye una sociedad mejor“
"Free software builds a better society"
— Richard Stallman