%META:TOPICINFO{author="ProjectContributor" date="1280633305" format="1.1" version="$Rev$"}%
%META:TOPICPARENT{name="FrequentlyAskedQuestions"}%
<blockquote class="foswikiHelp">%X% Under normal circumstances, there should be no need to rebuild your %USERSWEB%.WikiUsers topic.</blockquote>

Sometimes, the %USERSWEB%.WikiUsers topic maintained by %SYSTEMWEB%.TopicUserMappingContrib may not reflect the true list of users registered on your Foswiki installation. This most commonly happens when:
   * You deleted or renamed users and forgot to edit the %USERSWEB%.WikiUsers topic, or
   * You migrated a TWiki installation and accumulated new registrations on the new %USERSWEB%.WikiUsers topic before you had a chance to initialise it with the old list from the old !TWikiUsers topic.

Assuming your wiki is configured to use %SYSTEMWEB%.TopicUserMappingContrib, the script below should refresh your %USERSWEB%.WikiUsers topic with an accurate list of users. It uses the [[%SYSTEMWEB%.VarUSERINFO][USERINFO]] macro, which protects user information from ordinary users - so this topic needs to be viewed with [[%SYSTEMWEB%.AccessControl#The_Super_Admin_Group][admin privileges]] in order for it to be useful.

%TWISTY{showlink="Show code..."}%
%JQREQUIRE{"chili"}%
<verbatim class="tml">
%STARTSECTION{"WIKIUSERS"}%
%FORMAT{"A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z" 
    type="string" 
    format="   * $item - &lt;a name='$item'&gt;- - - -&lt;/a&gt; $percentINCLUDE{
        \"%TOPIC%\"
        section=\"USERS\"
        letter=\"$item\"
    }$percent" 
}% 
%ENDSECTION{"WIKIUSERS"}%

%STARTSECTION{"USERS"}%%SEARCH{
    "name=~'^%letter%.*' AND (form.name~'*UserForm')"
    type="query"
    web="%USERSWEB%"
    nonoise="on"
    header="$n"
    format="   * $percentUSERINFO{
        \"$topic\"
        format=\"$dollarwikiname - $dollarusername\"
    }$percent - $createdate"
}%%ENDSECTION{"USERS"}% 
</verbatim>

%ENDTWISTY%

<sticky>
<form action="%SCRIPTURLPATH{"save"}%/%USERSWEB%/WikiUsers" method="post">
<textarea name="text" rows="20" cols="80">
%INCLUDE{"UsersTemplate" section="header"}%
%INCLUDE{"%TOPIC%" section="WIKIUSERS"}%
%INCLUDE{"UsersTemplate" section="footer"}%
</textarea>

<input type="submit" value="Update %USERSWEB%.<nop>WikiUsers"/> </form>
</sticky>

%META:FORM{name="FAQForm"}%
%META:FIELD{name="TopicTitle" attributes="H" title="<nop>TopicTitle" value="Rebuilding WikiUsers topic"}%
%META:FIELD{name="TopicClassification" attributes="" title="TopicClassification" value="FrequentlyAskedQuestion"}%
%META:FIELD{name="TopicSummary" attributes="" title="Topic Summary" value="How can I re-build my %25USERSWEB%25.WikiUsers topic?"}%
%META:FIELD{name="InterestedParties" attributes="" title="Interested Parties" value=""}%
%META:FIELD{name="RelatedTopics" attributes="" title="Related Topics" value="Foswiki:Support.Faq27, %25SYSTEMWEB%25.TopicUserMappingContrib, %25USERSWEB%25.WikiUsers, %25SYSTEMWEB%25.AdminDocumentationCategory"}%
