If somone does something which makes him an invalid witness, is he considered an invalid witness only after Bes Din declares him invalid or is he always invalid? For example, Reuven does something which makes him an invalid witness but nobody knows about it. Can he be a witness for a wedding? Does the marriage take effect?
מַה בֵּין פָּסוּל לְעֵדוּת מִן הַתּוֹרָה, לְפָסוּל מִדִּבְרֵיהֶם: שֶׁפָּסוּל מִן הַתּוֹרָה שֶׁהֵעִיד--עֵדוּתוֹ בְּטֵלָה, אַף עַל פִּי שֶׁלֹּא הִכְרִיזוּ עָלָיו בְּבָתֵּי כְּנָסִיּוֹת וּבְבָתֵּי מִדְרָשׁוֹת. וְהַפָּסוּל מִדִּבְרֵיהֶם, צָרִיךְ הַכְרָזָה.
What is the difference between someone who is invalid [to testify] biblically as opposed to rabinically? One who is invalid biblically, his testimony is void, even if they did not announce regarding him in the synagogues and study halls. Whereas, one who is invalid rabinically requires an announcement.
In a comment, you indicated that you were interested in the status of one who eats in the street.
וְכֵן הַבְּזוּיִין, פְּסוּלִין לְעֵדוּת מִדִּבְרֵיהֶם; וְהֶם הָאֲנָשִׁים שֶׁהוֹלְכִין וְאוֹכְלִין בַּשּׁוּק לִפְנֵי כָּל הָעָם
And similarly those who are lowly are invalid to testify rabinically. These are those people who walk and eat in the street in front of everyone.
Such a person is then only invalid once the court has mad a public announcement to that effect.
This is in contrast to say, a thief, who is invalid bibilically. In this case, Rambam (Hilchot Edut 10:4) rules that he is invalid from the moment he stole (without the requirement for an announcement).
However, we would need two witnesses to testify to the theft, and then he becomes invalid retroactively from the time of the theft. His own admission to having stolen would be insufficient to invalidate him. (See Rambam Hilchot Edut 12:2.)